help-gnu-emacs
[Top][All Lists]
Advanced

[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 <address@hidden>,
 Matthias Benkard <address@hidden> 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, address@hidden
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 ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]