Closures/Value capture: Difference between revisions

Content added Content deleted
(→‎{{header|Factor}}: "Forget the variable!" Add a version that uses fried quotations.)
(→‎{{header|Common Lisp}}: Add 3 sentences to describe this code.)
Line 163: Line 163:
64</lang>
64</lang>


The ''loop'' mutates its binding ''i''. The purpose of <code>(let ((i i)) ...)</code> is to create a different binding ''i'' for each ''lambda'' to capture. Otherwise, all 10 lambdas would capture the same binding and return 100.


=={{header|D}}==
=={{header|D}}==