4 Examples top

  • user=> (def my-val 5)
    user=> my-val
  • user=> (def my-function (fn [x] (* x x x)))
    user=> (my-function 4)
  • ;; This is an example of setting a docstring during a def.
    ;; (Note that the clojure.repl namespace which contains the
    ;;  doc function is not loaded by default in Emacs' SLIME mode.)
    user> (def ted-nugent "the nuge rocks" 123)
    user> (doc ted-nugent)
      The nuge rocks
    user> ted-nugent
  • ;; give function another name
    user=> (def sys-map map)
    ;; give macro another name
    user=> (def #^{:macro true} sys-loop #'loop)
Log in to add / edit an example.

See Also top

Log in to add a see also.

Comments top

No comments for def. Log in to add a comment.