Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!godot.cc.duq.edu!news.duke.edu!news.mathworks.com!yeshua.marcam.com!zip.eecs.umich.edu!caen!saimiri.primate.wisc.edu!hpg30a.csc.cuhk.hk!news.ust.hk!cswsfok
From: cswsfok@ug.cs.ust.hk (FOK WAI SUM)
Subject: Re: Q: How do I construct a list and call it?
Message-ID: <1994Nov4.090701.15046@uxmail.ust.hk>
Sender: usenet@uxmail.ust.hk (usenet account)
Nntp-Posting-Host: cssu22.cs.ust.hk
Organization: Hong Kong University of Science and Technology
X-Newsreader: TIN [version 1.2 PL2]
References: <cj.waters-0211940636570001@130.216.64.235>
Date: Fri, 4 Nov 1994 09:07:01 GMT
Lines: 43

Chris Waters (cj.waters@auckland.ac.nz) wrote:
: I'm a bit of a Lisp newbie (in fact more than just a bit) and I'm having
: trouble with when to quote and when not to quote. I am trying to take a
: variable containing a function call, append a new parameter, and evaluate
: the whole lot.

I am also a novice about LISP. Let me try to answer your question.

: Here is a simple example:

: (defun test (a b c)
:    (print c))
: (setq myfun '(test 4 5))
: (setq temp '((foo) (bar)))
: (eval (append myfun 'temp))

Since temp is not evaluated when you add a quote before it, temp is treated
as an atom, not the list you want. So, I think the last line change to
(eval (append myfun temp)) would work.

Moreover, append an atom to a list will give you a dotted pair.

Hope this may help.

: I would expect this to call the function test and print out ((foo) (bar))
: which is the behaviour I want. The problem is that the list returned by
: the append function is: (test 4 5 . temp) and the interpreter (MCL) says
: can't take the car of temp. How do get the new parameter (temp) without
: the dot?

: -- 
: Chris Waters                              cj.waters@auckland.ac.nz
: Department of Electrical & Electronic Engineering
: University of Auckland, New Zealand

--
HKUST(Name,Year,Dept)|info = HKUST(Fok Wai Sum, 3, MATH)|info
info={	
	Name :	Fok Wai Sum
	Year : 	3
	Dept : 	MATH
}

