Greetings. I wonder if there is an emacs lisp veteran out there -
I don't know if you would call it the canonical formulation, but to bind a local function I am advised by the GNU manual to use 'flet':
(defun adder-with-flet (x)
(flet ( (f (x) (+ x 3)) )
(f x))
)
However, by accident I tried (after having played in Scheme for a bit) the following expression, where I bind a lambda expression to a variable using 'let', and it also works if I pass the function to mapcar*:
(defun adder-with-let (x)
(let ( (f '(lambda (x) (+ x 3))) )
(car (mapcar* f (list x)) ))
)
And both functions work:
(adder-with-flet 3) ==> 6
(adder-with-let 3) ==> 6
I am wondering if anyone knew why the second one works because I cannot find any documentation where 'let' can be used to bind functions to symbols?
Thanks! Stephen (P.S. I originally posted this on Emacs Help forums but got no reply so thought I'd hit up a different community - is that still called cross-posting?)