def

added

ns
clojure.core

type
var

Creates and interns or locates a global var with the name of symbol and a
namespace of the value of the current namespace (*ns*). See
http://clojure.org/special_forms for more information.

                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)