|
From: | Michael Heerdegen |
Subject: | Re: Closures - do you understand them well? |
Date: | Sat, 10 Dec 2022 01:12:18 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) |
Michael Heerdegen <michael_heerdegen@web.de> writes: > Write an expression that returns a list of 100 functions accepting zero > arguments. `funcall'ing the Nth function must return N. Use a `while' > loop or whatever you like but please not `dolist' or any tool that > already handles this "problem" specifically. Would this be a valid solution? #+begin_src emacs-lisp (let ((i 0) (funs)) (while (<= (cl-incf i) 100) (push (apply-partially #'identity i) funs)) (nreverse funs)) #+end_src Michael.
[Prev in Thread] | Current Thread | [Next in Thread] |