(lispref.info)Macro Forms

Next: Special Forms Prev: Function Forms Up: Forms

Lisp Macro Evaluation

   If the first element of a list being evaluated is a macro object,
then the list is a "macro call".  When a macro call is evaluated, the
elements of the rest of the list are *not* initially evaluated.
Instead, these elements themselves are used as the arguments of the
macro.  The macro definition computes a replacement form, called the
"expansion" of the macro, which is evaluated in place of the original
form.  The expansion may be any sort of form: a self-evaluating
constant, a symbol or a list.  If the expansion is itself a macro call,
this process of expansion repeats until some other sort of form results.

   Normally, the argument expressions are not evaluated as part of
computing the macro expansion, but instead appear as part of the
expansion, so they are evaluated when the expansion is evaluated.

   For example, given a macro defined as follows:

     (defmacro cadr (x)
       (list 'car (list 'cdr x)))

an expression such as `(cadr (assq 'handler list))' is a macro call,
and its expansion is:

     (car (cdr (assq 'handler list)))

Note that the argument `(assq 'handler list)' appears in the expansion.

   Note: Macros, for a complete description of Emacs Lisp macros.

automatically generated by info2www