macro | since v0.0-927 | imported clojure.core/letfn | Edit |
(letfn fnspecs & body)
Takes a vector of function definitions fnspecs
and binds the functions to
their names. All of the names are available in all of the definitions of the
functions as well as body
.
fnspecs
must be a vector with an even number of forms. See let
.
letfn
is a wrapper over one of ClojureScript's special forms.
fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+) Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body.
(defmacro letfn
{:added "1.0", :forms '[(letfn [fnspecs*] exprs*)],
:special-form true, :url nil}
[fnspecs & body]
`(letfn* ~(vec (interleave (map first fnspecs)
(map #(cons `fn %) fnspecs)))
~@body))