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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lambda inside a let or letrec


From: Thomas A. Russ
Subject: Re: lambda inside a let or letrec
Date: Wed, 08 Dec 2010 15:12:59 -0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

bolega <gnuist006@gmail.com> writes:

> let me write it more clearly with indents as follows :
> 
> (let
> ((a (lambda (n) (+ 1 n)))
>  (b 3))
> (a b))

This will work in a so-called 'lisp-1' like Scheme.
It will not work in a so-called 'lisp-2' like Common Lisp or Emacs Lisp.

The issue has to do with whether or not there is a separate function
value namespace or not.  In Common Lisp or Emacs Lisp you need to use
FUNCALL to make it work

(let ((a (lambda (n) (+ 1 n)))
      (b 3))
  (funcall a b))

because the LAMBDA expression you want is in the value namespace (slot)
of the symbol A and not in the function namespace (slot).

-- 
Thomas A. Russ,  USC/Information Sciences Institute


reply via email to

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