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

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

Re: Closures - do you understand them well?


From: Michael Heerdegen
Subject: Re: Closures - do you understand them well?
Date: Fri, 09 Dec 2022 17:55:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Emanuel Berg <incal@dataswamp.org> writes:

> This is why you should never quote lambdas because if you do,
> you get the intuitive result:
>
> (let ((i 0)
>       (funs '()))
>   (while (< (setq i (1+ i))
>             4)
>     (push `(lambda () ,i)
>           funs))
>   (apply #'+ (mapcar #'funcall funs))) ; 6

I think the intended goal was to see that shortcuts can cause trouble,
not to try to find a better shortcut...

Michael.




reply via email to

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