[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nested Lambda function gives error in common lisp, guile, emacs lisp
From: |
Barry Margolin |
Subject: |
Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why? |
Date: |
Mon, 08 Oct 2007 08:24:18 -0400 |
User-agent: |
MT-NewsWatcher/3.5.2 (PPC Mac OS X) |
In article <1191802159.161767.239420@k79g2000hse.googlegroups.com>,
Matthias Benkard <mulkiatsch@gmail.com> wrote:
> > [1]> (((lambda (a) (lambda (b) (list a b))) 1) 2)
> >
> > *** - EVAL: ((LAMBDA (A) (LAMBDA (B) (LIST A B))) 1) is not a function
> > name; try using a symbol
> > instead
>
> As the others have already told you, you can't just put any arbitrary
> expression in the CAR of a form to be evaluated. Now, it's not quite
> true that you can only use symbols in the CAR of evaluated forms,
> either, because you can also put a lambda expression there. Note that
> by this I do not mean just any expression that evaluates to a function
> object, but really simply a lambda expression: a list whose CAR is the
> symbol LAMBDA (and which can be evaluated to a function object).
I think what has made this more confusing than it was in the days of
Maclisp was the introduction of the LAMBDA macro. Now (lambda ...)
evaluates to a function, so when you put a lambda expression in the CAR
of a form it looks like the CAR is being evaluated, which suggests the
assumption that any expression can be put there to be evaluated (with
the special case that symbols are looked up in the function namespace).
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, (continued)
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, David Rush, 2007/10/07
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, William D Clinger, 2007/10/08
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, Pascal Costanza, 2007/10/08
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, namekuseijin, 2007/10/08
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, Pascal Costanza, 2007/10/08
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, Don Geddis, 2007/10/08
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, Pascal Costanza, 2007/10/08
Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?, Matthias Benkard, 2007/10/08
- Re: Nested Lambda function gives error in common lisp, guile, emacs lisp but works in scheme. Why?,
Barry Margolin <=