- or download this
use v6;
my @blocks := (0..*).map: -> $n { -> $x, $y { $x * $y * $n } };
say @blocks[2](2, 9);
- or download this
sub gen($x, $y) { state $n = 0; $x*$y*$n++ }
my @foo := &gen xx *;
- or download this
my @foo := sub ($x, $y) { state $n = 0; $x*$y*$n++ } xx *;
- or download this
say @foo[2](1, 1);
say @foo[0](1, 1);
say @foo[5](1, 1);
say @foo[0](1, 1);
- or download this
0
0
0
1