Closures/Value capture: Difference between revisions

m
→‎{{header|Raku}}: Fix comment: Perl 6 --> Raku
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (→‎{{header|Raku}}: Fix comment: Perl 6 --> Raku)
Line 1,809:
(formerly Perl 6)
{{Works with|Rakudo|2015.12}}
All blocks are anonymous closures in Perl 6Raku, and parameters are lexicals, so it's easy to generate a list of them. We'll use a <tt>gather</tt>/<tt>take</tt> generator loop, and call the closures in random order, just to keep things interesting.
<lang perl6>my @c = gather for ^10 -> $i {
take { $i * $i }
2,392

edits