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

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

Re: fif function from On Lisp


From: Johan Bockgård
Subject: Re: fif function from On Lisp
Date: Tue, 04 Mar 2008 13:53:51 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

weber <hugows@gmail.com> writes:

> Hi folks.
> For some reason this function from On Lisp doesn't work:
>
> (defun fif (a b &optional c)
>   '(lambda (x)
>       (if (funcall a x)
>               (funcall b x)
>               (unless (null c) (funcall c x)))))
>
> I should be able to call it like this:
>
> (mapcar (fif 'zerop '1+ 1-) '(0 1 2 3) => (1 0 1 2)
>
> but i'm probably missing something that is differs from Common Lisp to
> Elisp.

The code above doesn't work in Common Lisp either, but anyway, Emacs
Lisp doesn't have lexical closures (yet).

(info "(elisp) Extent")

-- 
Johan Bockgård


reply via email to

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