Common Lisp the Language 2nd Edition


next up previous contents index
Next: Destructuring Up: Macros Previous: Macro Definition

8.2. Macro Expansion

The macroexpand function is the conventional means for expanding a macro call. A hook is provided for a user function to gain control during the expansion process.


[Function]
macroexpand form &optional env
macroexpand-1 form &optional env

If form is a macro call then macroexpand-1 will expand the macro call once and return two values: the expansion and t. If form is not a macro call then the two values form and nil are returned.

A form is considered to be a macro call only if it is a cons whose car is a symbol that names a macro. The environment env is similar to that used within the evaluator (see evalhook); it defaults to a null environment. Any local macro definitions established within env by macrolet will be considered. If only form is given as an argument then the environment is effectively null then the environment is effectively nullf only form is given as an similartt>
macroexpand-1 form