Clojure Tutorial: Macro

By Xah Lee. Date:

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.

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/macroexpand

clojure.core/macroexpand-1

reference