From: Troy McKinnon
Subject: simple question
Date: 
Message-ID: <3473A10D.6C1D@cryogen.com>
Hi again,

Just wondering.  I have this code:\

(pickup (setf Pre '((handempty) (ontable (last Action)) (cleartop (last
Action)))))

My problem is it sets <Pre> to ((handempty) (ontable (last Action))
(cleartop (last Action)))

instead of:

((handempty) (ontable a) (cleartop a))

I know this is because the list is defined with a ('), how do I get by
this?  How do I make things evaluate inside of a '(  )?


Thanks

From: Barry Margolin
Subject: Re: simple question
Date: 
Message-ID: <650p0v$5h2@pasilla.bbnplanet.com>
In article <·············@cryogen.com>,
Troy McKinnon  <········@cryogen.com> wrote:
](pickup (setf Pre '((handempty) (ontable (last Action)) (cleartop (last
]Action)))))
]
]My problem is it sets <Pre> to ((handempty) (ontable (last Action))
](cleartop (last Action)))
]
]instead of:
]
]((handempty) (ontable a) (cleartop a))
]
]I know this is because the list is defined with a ('), how do I get by
]this?  How do I make things evaluate inside of a '(  )?

Use backquote instead of quote, which allows you to indicate forms to be
evaluated using comma:

(setq pre `((handempty) (ontable ,(last action)) (cleartop ,(last action))))

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.
From: Axel Schairer
Subject: Re: simple question
Date: 
Message-ID: <3473FA28.762D@dfki.uni-sb.de>
Barry Margolin wrote:
> 
> In article <·············@cryogen.com>,
> Troy McKinnon  <········@cryogen.com> wrote:
> ](pickup (setf Pre '((handempty) (ontable (last Action)) (cleartop (last
> ]Action)))))
> ]
> ]My problem is it sets <Pre> to ((handempty) (ontable (last Action))
> ](cleartop (last Action)))
> ]
> ]instead of:
> ]
> ]((handempty) (ontable a) (cleartop a))
> ]
> ]I know this is because the list is defined with a ('), how do I get by
> ]this?  How do I make things evaluate inside of a '(  )?
> 
> Use backquote instead of quote, which allows you to indicate forms to be
> evaluated using comma:
> 
> (setq pre `((handempty) (ontable ,(last action)) (cleartop ,(last action))))

If you are a beginner and don't want to mess around with backquote quite
yet, there is still the possibility of building lists in the obvious
way, namely using (list <elem_1> ... <elem_n>).  

Problem is, your code will look a bit messy because of all the nested
(list ...) forms.  Anyway, something like 

	(setf pre (list '(handempty) (list 'ontable (last action))))

should do as well.  A.f.a.I.k. the semantics of this differs from the
semantics of the backquote expression, but this difference should not be
a problem here.

Axel