Closures/Value capture: Difference between revisions

Content added Content deleted
(Added Maple implementation)
Line 500: Line 500:
window.alert(funcs[3]()); // alerts "9"
window.alert(funcs[3]()); // alerts "9"
</script></lang>
</script></lang>

=={{header|Maple}}==
<lang Maple>> L := map( i -> (() -> i^2), [seq](1..10) ):
> seq( L[i](),i=1..10);
1, 4, 9, 16, 25, 36, 49, 64, 81, 100
> L[4]();
16
</lang>


=={{header|Mathematica}}==
=={{header|Mathematica}}==
Line 512: Line 520:
a[2]
a[2]
->4</lang>
->4</lang>



=={{header|Objective-C}}==
=={{header|Objective-C}}==