Clojure Tutorial: Macro
This page is WORK IN PROGRESS.
Clojure has a thing called “macro”. It is like defn for defining a function. Except, it is used as a syntactic transformation. When a macro is defined, the compiler makes a note of it. When a macro is called, the compiler actually calls the transformed function.
(defmacro name doc-string? attr-map? [params*] body)
(defmacro name doc-string? attr-map? ([params*] body) + attr-map?)
Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called.
clojure.core/defmacro
clojure.core/cons
clojure.core/second
clojure.core/first
clojure.core/nnext
clojure.core/macroexpand
clojure.core/macroexpand-1