Author: Joost DiepenmaatJoost Diepenmaat Date: May 30, 2008 14:27
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))
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.
|