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.
;; 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)
;;Assign a Function to a Variable (def say-hello (fn [name] (str "Hello " name))) (say-hello "World") ;;"Hello World" ;;the same but using an anonymous function (def say-hello #(str "Hello " %)) (say-hello "World") ;;"Hello World" ;;anonymous function using two arguments (def hello-doc #(str "Hello " %1 %2)) (hello-doc "Dr." "House") ;;"Hello Dr.House"
;; function checks: variable = 9 or not user=> (def ?9 #(= % 9)) #'user/?9 user=> (?9 9) true user=> (?9 5) false
; add a doc-string to your def variable (def my-var "this is doc string for my var" "hello") ; add a doc-string using meta key `:doc` (def ^{:doc "this is doc string for my var"} my-var "hello")
Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-s...
params => positional-params*, or positional-params* & rest-param positional-param => binding-form ...
Like defn, but the resulting function name is declared as a macro and will be used as a macro by t...
Creates a new multimethod with the associated dispatch function. The docstring and attr-map are op...
defs name to have the root value of the expr iff the named var has no root value, else expr is une...
def