Closures/Value capture: Difference between revisions

Content added Content deleted
(→‎Insitux: inclusion)
m (→‎{{header|Wren}}: Changed to Wren S/H)
Line 2,268: Line 2,268:
Whenever we call a continuation, the <code>(block sqr ...)</code> environment is restored. and the suspended computation inside the block resumes by returning out of the <code>(suspend ...)</code> form normally. The block then executes to completion, returning the <code>(* cap cap)</code> form's value. At that point, our call to the continuation terminates, yielding that value.
Whenever we call a continuation, the <code>(block sqr ...)</code> environment is restored. and the suspended computation inside the block resumes by returning out of the <code>(suspend ...)</code> form normally. The block then executes to completion, returning the <code>(* cap cap)</code> form's value. At that point, our call to the continuation terminates, yielding that value.
=={{header|Wren}}==
=={{header|Wren}}==
<syntaxhighlight lang="ecmascript">var fs = List.filled(10, null)
<syntaxhighlight lang="wren">var fs = List.filled(10, null)
for (i in 0...fs.count) {
for (i in 0...fs.count) {
fs[i] = Fn.new { i * i }
fs[i] = Fn.new { i * i }
Line 2,287: Line 2,287:
Function #8: 64
Function #8: 64
</pre>
</pre>

=={{header|Yabasic}}==
=={{header|Yabasic}}==
<syntaxhighlight lang="Yabasic">
<syntaxhighlight lang="Yabasic">