##
sub gen($x, $y) { state $n = 0; $x*$y*$n++ }
my @foo := &gen xx *;
####
my @foo := sub ($x, $y) { state $n = 0; $x*$y*$n++ } xx *;
####
say @foo[2](1, 1);
say @foo[0](1, 1);
say @foo[5](1, 1);
say @foo[0](1, 1);
####
0
0
0
1