Passing an (optional) attr-map?
to defn
is a shorthand way of adding metadata to a function's var.
Metadata might include entries such as :tag
(runtime return type), :doc
(a documentation string) and :private
(to indicate if the var is private to a namespace). Additional pieces of metadata can also be attached there too, but should be used for data that is "orthogonal to the logical value of the data" (quote from http://clojure.org/functional_programming)
(defn greet {:tag String :other-meta-data 5} [name] (format "Hello, %s" name))
(meta #'f)
;=> {:arglists ([name]), :ns #<Namespace user>, :name f, :end-column 8, :column 1,
:line 4 :other-meta-data 5, :file "NO_SOURCE_FILE", :end-line 4,
:tag java.lang.String}