RosettaCodeData/Task/Closures-Value-capture/Mathematica/closures-value-capture.math

6 lines
119 B
Plaintext

Function[i, i^2 &] /@ Range@10
->{1^2 &, 2^2 &, 3^2 &, 4^2 &, 5^2 &, 6^2 &, 7^2 &, 8^2 &, 9^2 &, 10^2 &}
%[[2]][]
->4