Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!purdue!haven.umd.edu!news5.digex.net!news2.digex.net!uunet!in1.uu.net!205.252.116.190!feed1.news.erols.com!howland.erols.net!worldnet.att.net!ix.netcom.com!netcom.com!vfr750
From: vfr750@netcom.com (Will Hartung)
Subject: Re: Macro question (technical)
Message-ID: <vfr750E31LHn.8pA@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <32C24DD5.7B51@en.com>
Date: Thu, 26 Dec 1996 22:36:59 GMT
Lines: 54
Sender: vfr750@netcom5.netcom.com

Big G <garrett@en.com> writes:

>Sorry for the new-lisp-user-dumb-question (this appears to be a philosphy
>of lisp newsgroup?), but I have a technical question regarding macros. I am 
>trying to substitute a list of conditions to a let statement.

comp.lang.lisp: Like Lisp. Code Lisp. Live Lisp.

Personally, I like the new-lisp-user-dumb-question because I'm a
dumb-new-lisp-user. :-)

>------------------------
>; Here's the code I am trying

>(defvar conditions '((a 1) (b 2)))

>(defmacro test-fun (x)
>   `(let (,x)
>      (print a)
>      (print b)
>    )
>)

>(test-fun conditions)

As someone else mentioned, during expansion the value of 'x' in
'conditions', and what you want is the value of 'conditions'.

So, I futzed about and came up with:
   THE (not just any, but THE) new-lisp user ultra-faux pas.

Check this out:

(defmacro test-fun (x)
     `(let ,(eval x)
         (print a)
         (print b)))

It works, but rumour has it that you'll go to Hell if you use it,
being its soiled with an 'eval'. 

But, according to the CL Help that I was reading, inside of a
backquote, the ',' (comma) evaluates the form following it. But since
you wanted the value of the value of x (**x :-)), that was all I could
think of.

Now is a fine time for the Net Lisp Gods to smite me, and show The Way
and help pull both you and I from our personal purgatories.

I, humbly, await redemption.
-- 
Will Hartung - Rancho Santa Margarita. It's a dry heat. vfr750@netcom.com
1990 VFR750 - VFR=Very Red    "Ho, HaHa, Dodge, Parry, Spin, HA! THRUST!"
1993 Explorer - Cage? Hell, it's a prison.                    -D. Duck
