Hello,

Bastien <b...@gnu.org> writes:

> Eric Schulte <eric.schu...@gmx.com> writes:
>
>> I'm surprised that elisp doesn't provide any mechanism for local
>> anonymous functions.  
>
> (let ((my-local-func (lambda (a) (message a))))
>      (funcall my-local-func "Hello!"))
>
> is fine.
>
> It's just for recursive local function -- letrec provides it now, 
> but apparently cl-labels was needed for that before.

You can have recursive local functions:

#+begin_src emacs-lisp
(let* (len                              ; For byte compiler.
       (len (lambda (l) (if (not l) 0
                     (1+ (funcall len (cdr l)))))))
  (funcall len '(1 2 3)))
#+end_src


Regards,

-- 
Nicolas Goaziou

Reply via email to