From: ········@ptcstudios.com
Subject: macro argument verifying (newbie question)
Date: 
Message-ID: <rxLUOGlgjMhqtpeJYGM66oAqEsHV@4ax.com>
HI-

I have a small problem.  I am wrting a macro which takes (in part) a
list of lists.  I want to verify that what is passed is actually a
list of lists before I generate the expansion.  So I have:

(defmacro foo (some-list)
   (if (not (every #'listp some-list) )
       (error "Parameter 'some-list' is not a list of lists.") )
   
   ; ... textual substituion done here...
)


I am finding that the error always occurs, even when some-list is
really a list of lists.

Thanks in advance.

·········@ptcstudios.com
From: Barry Margolin
Subject: Re: macro argument verifying (newbie question)
Date: 
Message-ID: <mDUA4.10$SW5.199@burlma1-snr2>
In article <····························@4ax.com>,
 <········@ptcstudios.com> wrote:
>HI-
>
>I have a small problem.  I am wrting a macro which takes (in part) a
>list of lists.  I want to verify that what is passed is actually a
>list of lists before I generate the expansion.  So I have:
>
>(defmacro foo (some-list)
>   (if (not (every #'listp some-list) )
>       (error "Parameter 'some-list' is not a list of lists.") )
>   
>   ; ... textual substituion done here...
>)
>
>
>I am finding that the error always occurs, even when some-list is
>really a list of lists.

Remember that the macro's parameters are the sub-expressions of the
invoking form, *not* the run-time values of those expressions.

If you need to check the value of a variable, you have to put the check
into the expansion, not do it in the macro itself.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.