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

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

Re: newbie questions: why doesn't ((lambda (x) (x 2)) (lambda (n) (+ n 3


From: Joost Diepenmaat
Subject: Re: newbie questions: why doesn't ((lambda (x) (x 2)) (lambda (n) (+ n 3))) work in elisp?
Date: Fri, 30 May 2008 23:33:23 +0200
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.0.60 (gnu/linux)

Joost Diepenmaat <joost@zeekat.nl> writes:
> Tahsin Alam <tahsin.alam@db.com> writes:
>
>> As the subject says - why does the following expression give error when I 
>> try to evaluate it in the *scratch* buffer?
>>
>> ((lambda (x) (x 2)) (lambda (n) (+ n 3)))
>
> Because ((some call evaluating to a function)) isn't valid in emacs
> lisp, which also means
>
> (lambda (x) (x 2))

unless, of course, you've got a (defun x (y) ...) somewhere...

> has no real meaning in elisp (it does in scheme, but not in elisp or
> common lisp, because elisp and cl have separate namespaces for
> functions and variables). You want either
>
> (funcall (lambda (x) (funcall x 2)) (lambda (n) (+ n 3)))
>
> or possibly
>
> (list (lambda (x) (list x 2)) (lambda (n) (+ n 3)))
>
> or some permutation of both.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


reply via email to

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