Liking cljdoc? Tell your friends :D
Clojure only.

flatland.useful.macro


anon-macrocljmacro

(anon-macro args macro-body & body)

Define, and then immediately use, an anonymous macro. For example, (anon-macro [x y] `(def ~x ~y) myconst 10) expands to (def myconst 10).

Define, and then immediately use, an anonymous macro. For
example, (anon-macro [x y] `(def ~x ~y) myconst 10) expands to (def
myconst 10).
sourceraw docstring

macro-docljmacro

(macro-do macro-args body & args)

Wrap a list of forms with an anonymous macro, which partitions the forms into chunks of the right size for the macro's arglists. The macro's body will be called once for every N items in the args list, where N is the number of arguments the macro accepts. The result of all expansions will be glued together in a (do ...) form.

Really, the macro is only called once, and is adjusted to expand into a (do ...) form, but this is probably an implementation detail that I'm not sure how a client could detect.

For example, (macro-do [[f & args]] `(def ~(symbol (str "basic-" f)) (partial ~f ~@args)) [f 'test] [y 1 2 3]) expands into (do (def basic-f (partial f 'test)) (def basic-y (partial y 1 2 3)))

Wrap a list of forms with an anonymous macro, which partitions the
forms into chunks of the right size for the macro's arglists. The
macro's body will be called once for every N items in the args
list, where N is the number of arguments the macro accepts. The
result of all expansions will be glued together in a (do ...) form.

Really, the macro is only called once, and is adjusted to expand
into a (do ...) form, but this is probably an implementation detail
that I'm not sure how a client could detect.

For example,
(macro-do [[f & args]]
          `(def ~(symbol (str "basic-" f))
             (partial ~f ~@args))
          [f 'test] [y 1 2 3])
expands into (do
              (def basic-f (partial f 'test))
              (def basic-y (partial y 1 2 3)))
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close