I am trying to put the parameters in a for loop into array of FIXED size. This is what I have been doing (I want to use a array @m of 3 elements):
for (1..19).rotor(3, :partial) -> @m { say @m; } # works, but I cannot specify size of @m
However, all of the following give me errors:
for (1..19).rotor(3, :partial) -> @m[0,1,2] { say @m; }
===SORRY!=== Error while compiling:
Variable '@m' is not declared
------> ).rotor(3, :partial) -> @m[0,1,2] { say ⏏@m; }
for (1..19).rotor(3 => -2) -> @m[0..2] { say @m; }
===SORRY!=== Error while compiling:
Variable '@m' is not declared
------> 1..19).rotor(3 => -2) -> @m[0..2] { say ⏏@m; }
for (1..19).rotor(3 => -2) -> @m[3] { say $_; say @m; }
===SORRY!=== Error while compiling:
Variable '@m' is not declared
------> ).rotor(3 => -2) -> @m[3] { say $_; say ⏏@m; }
So, how should I specify that the array @m must have only 3 elements?