API for macro-utils
(master branch)
by
Konrad Hinsen
Usage:
(ns your-namespace
(:require clojure.contrib.macro-utils))
Overview
Local macros and symbol macros
Local macros are defined by a macrolet form. They are usable only
inside its body. Symbol macros can be defined globally
(defsymbolmacro) or locally (symbol-macrolet). A symbol
macro defines a form that replaces a symbol during macro
expansion. Function arguments and symbols bound in let
forms are not subject to symbol macro expansion.
Local macros are most useful in the definition of the expansion
of another macro, they may be used anywhere. Global symbol
macros can be used only inside a with-symbol-macros form.
Public Variables and Functions
defsymbolmacro
macro
Usage: (defsymbolmacro symbol expansion)
Define a symbol macro. Because symbol macros are not part of
Clojure's built-in macro expansion system, they can be used only
inside a with-symbol-macros form.
deftemplate
macro
Usage: (deftemplate name params & forms)
Define a macro that expands into forms after replacing the
symbols in params (a vector) by the corresponding parameters
given in the macro call.
macrolet
macro
Usage: (macrolet fn-bindings & exprs)
Define local macros that are used in the expansion of exprs. The
syntax is the same as for letfn forms.
mexpand
function
Usage: (mexpand form)
Like clojure.core/macroexpand, but takes into account symbol macros.
mexpand-1
function
Usage: (mexpand-1 form)
Like clojure.core/macroexpand-1, but takes into account symbol macros.
mexpand-all
function
Usage: (mexpand-all form)
Perform a full recursive macro expansion of a form.
symbol-macrolet
macro
Usage: (symbol-macrolet symbol-bindings & exprs)
Define local symbol macros that are used in the expansion of exprs.
The syntax is the same as for let forms.
with-symbol-macros
macro
Usage: (with-symbol-macros & exprs)
Fully expand exprs, including symbol macros.