My question is: could I write below code in perl6: my @a = <1 2 3 4>; my @b[2]; for @a -> @b {;} # 2 loops like for @a -> $b[0],$b[1]{;} my @a = <1 2 3 4>; my @b; for @a -> @b {;} # 1 loop my @a = <1 2 3 4>; my @b[2]; grep(@b){say 'yes' if +...@b>3} <== @a; # 2 loops like grep {$^a+$^b >3} <== @a; my @a = <1 2 3 4>; grep{say 'yes' if +...@_ >=10} <== @a; # slurp
Since memory is cheaper and cheaper, bulky feed can maximize to make use of memory and reduce loops. Any thoughts?