1.3.0 permalink Arrow_down_16x16

4 Examples top

  • user=> (def my-val 5)
    #'user/my-val
    user=> my-val
    5
  • user=> (def my-function (fn [x] (* x x x)))
    #'user/my-function
    user=> (my-function 4)
    64
  • ;; 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/ted-nugent
    user> (doc ted-nugent)
    -------------------------
    user/ted-nugent
      The nuge rocks
    user> ted-nugent
    123
    
  • ;; 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.