From ...
From: Erik Naggum
Subject: Re: Function composition at run time
Date: 2000/10/19
Message-ID: <3180969984634156@naggum.net>#1/1
X-Deja-AN: 683500646
References: <39EDFA1B.145997A4@nc.rr.com> <39EE12BC.A053F10@nc.rr.com> <39EE33D6.A7575B2C@nc.rr.com>
mail-copies-to: never
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsmaster@eunet.no
X-Trace: oslo-nntp.eunet.no 971981263 16802 195.0.192.66 (19 Oct 2000 18:47:43 GMT)
Organization: Naggum Software; vox: +47 800 35477; gsm: +47 93 256 360; fax: +47 93 270 868; http://naggum.no; http://naggum.net
User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7
Mime-Version: 1.0
NNTP-Posting-Date: 19 Oct 2000 18:47:43 GMT
Newsgroups: comp.lang.lisp
* "David E. Young"
| I was hoping I could splice these forms into a function object and
| just FUNCALL the object whenever necessary.
Back in the old days, funcall (and friends) treated an argument that
was a list whose car was the symbol lambda as a function. Some
Common Lisp implementations still do that out of courtesy to the old
ways, but ANSI Common Lisp specifies that they should be coerced
into functions as if by evaluating (eval `(function ,))
before being funcallable.
| Perhaps I can't? Should I just store the forms and call EVAL at the
| appropriate time instead?
Suppose you have a list of forms to evaluate in a variable .
(eval `(progn ,)) will evaluate them in order. If you want a
function object, you need (eval `(function (lambda () ,))),
and then you need to funcall the result. Unless you want to compile
the function, as in (compile nil `(lambda () ,)), of course.
In most cases, the progn solution should be quite adequate.
#:Erik
--
I agree with everything you say, but I would
attack to death your right to say it.
-- Tom Stoppard