Next: , Previous: , Up: The language   [Contents][Index]

5.10 Macros

Macros are used to extend the Lisp language. They consist of a function which instead of returning a computed value, transform their unevaluated arguments into a new form that, when evaluated, produces the actual value of the original form.

For example, the when macro (see Conditional Structures) implements a new conditional operation by transforming its arguments into a cond statement. That is,

(when condition form …)
    → (cond (condition form …))

Since macros do not evaluate their arguments, instead just transforming them, they may be expanded at compile-time. The resulting form is then compiled as usual.

Function: macrop arg

Returns true if arg is a macro object.