Closures/Value capture: Difference between revisions
Content added Content deleted
(→{{header|Groovy}}: new solution) |
(Updated D versions) |
||
Line 174: | Line 174: | ||
funcs ~= { |
funcs ~= { |
||
int i = j; |
int i = j; |
||
return |
return () => i ^^ 2; |
||
}(); |
}(); |
||
Line 185: | Line 185: | ||
void main() { |
void main() { |
||
auto funcs = map! |
auto funcs = map!(i => () => i*i)(iota(10)); |
||
writeln(map!q{ a() }(funcs)); |
writeln(map!q{ a() }(funcs)); |
||
}</lang> |
}</lang> |