4 ms·
Common Lisp: (setf *a* nil) (dotimes (x 3) (push (lambda () x) *a*)) (mapcar #'funcall *a*) prints (3 3 3 3) as well. I think the author is
by SeanLuke 12y ago
Common Lisp:
(setf *a* nil)
(dotimes (x 3)
(push (lambda () x) *a*))
(mapcar #'funcall *a*)
prints (3 3 3 3) as well. I think the author is mixing up variable capture with scoping.