Closures/Value capture: Difference between revisions

m
m (moved Closures/Variable capture to Closures/Value capture: Better describes the task)
Line 510:
 
=={{header|Mathematica}}==
<lang Mathematica>a[i_] := Function[zi, z*z][i^2 &] /@ Range@10
->{1^2 &, 2^2 &, 3^2 &, 4^2 &, 5^2 &, 6^2 &, 7^2 &, 8^2 &, 9^2 &, 10^2 &}
 
a%[[2]][]
->4
 
a[5]
->25
 
a[2]
->4</lang>