Jump to content

Closures/Value capture: Difference between revisions

Added Maple implementation
(Added Maple implementation)
Line 500:
window.alert(funcs[3]()); // alerts "9"
</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}}==
Line 512 ⟶ 520:
a[2]
->4</lang>
 
 
=={{header|Objective-C}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.