Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

macroexpand-1

macroexpand-1

type: function (subr) 
location: built-in
source file: xlbfun.c
Common LISP compatible: similar
supported on: all machines

SYNTAX

(macroexpand-1 <form> )
        <form>          -       a macro form

DESCRIPTION

The MACROEXPAND-1 function takes a <form> and expands the first level of the macro definition used in the <form>. The function returns the expansion. If the <form> does not contain a macro, the form is returned unaltered.

EXAMPLES

(defmacro plus (n1 n2) `(+ ,n1 ,n2))    ; define PLUS macro
(plus 1 2)                              ; returns 3
(macroexpand '(plus 3 4))               ; returns (+ 3 4)
(macroexpand-1 '(plus 3 4))             ; returns (+ 3 4)
                                        ;
(defmacro pl (p1 p2) `(plus ,p1 ,p2))   ; define PL macro using PLUS
(pl 3 4)                                ; returns 7
(macroexpand '(pl 3 4))                 ; returns (+ 3 4)
(macroexpand-1 '(pl 3 4))               ; returns (PLUS 3 4)

COMMON LISP COMPATIBILITY: Common LISP returns 2 values for its result of MACROEXPAND-1 - the expanded form and a T or NIL value that indicates if the <form> was a macro. XLISP returns only the expanded form.

COMMON LISP COMPATIBILITY: Common LISP supports an optional argument in MACROEXPAND-1 for the environment of the expansion. XLISP does not support this optional argument.


Go to the first, previous, next, last section, table of contents.