Subject: Re: Question about lisp macros
From: (Rob Warnock)
Date: Wed, 02 Feb 2005 05:56:23 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Andreas Thiele <> 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)))

    > (macro-function 'foo)

    #<Interpreted Function "DEFMACRO FOO" {48536BA1}>
    > (describe *)

    #<Interpreted Function "DEFMACRO FOO" {48536BA1}> is function.
      (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 Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607