Andreas Thiele <nospam@nospam.com> wrote:
+---------------
| A macro cannot be called like a function.
| (funcall macro-symbol ...
| is not possible
+---------------
Well, you *can*, but the macro function probably isn't what you'd
think it would be from looking at the DEFMACRO form. For one thing,
it always takes exactly two arguments (&whole form &environment env),
not whatever args the DEFMACRO had:
> (defmacro foo (a b c)
`(list ',a ,b ,(1+ c)))
FOO
> (macro-function 'foo)
#<Interpreted Function "DEFMACRO FOO" {48536BA1}>
> (describe *)
#<Interpreted Function "DEFMACRO FOO" {48536BA1}> is function.
Arguments:
(A B C)
Its defined argument types are:
(T T)
Its result type is:
*
Its definition is:
(LAMBDA (#:WHOLE-984 #:ENV-985) (DECLARE #) (BLOCK FOO #))
> (funcall ** '(foo bar 1 2) nil)
(LIST 'BAR 1 3)
>
[Note that I gave NIL here for the environment, since I don't know
how to hand-craft a CMUCL macro environment.]
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607