From: Jeff
Subject: Macro woes
Date: 
Message-ID: <cfgijl$37e@odah37.prod.google.com>
*sigh* I wasn't expecting to create another thread so quickly :) Can
someone explain to me what the difference here is, and why I get the
results that I do:

(defmacro test (x) `(functionp ,x))

(test #'+) => T

---------------------

(defmacro test (x) `,(functionp x))

(test #'+) => NIL


My mind tells me that there should be no difference between the two of
these situations, but evidently there is. In case it matters, I'm using
Corman Lisp 2.5. 

Desparately seeking enlightenment :)

Jeff
From: Marco Baringer
Subject: Re: Macro woes
Date: 
Message-ID: <m27js4unfe.fsf@convey.it>
"Jeff" <ยทยทยท@insightbb.com> writes:

> My mind tells me that there should be no difference between the two of
> these situations, but evidently there is. In case it matters, I'm using
> Corman Lisp 2.5. 

marcoexpand is your friend.

CL-USER> (defmacro test (x) `(functionp ,x))
TEST
CL-USER> (macroexpand '(test #'+))
(FUNCTIONP #'+)
T
CL-USER> (defmacro test (x) `,(functionp x))
TEST
CL-USER> (macroexpand '(test #'+))
NIL
T

the second macro is calling functionp on the form (function +) and
expanding into that. a list is not a function. so your second macro
always expands into NIL. evaling NIL returns NIL.

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen