3 ms·
> my @values = [1 .. 20]; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 > say @values[0,2,4 ... *]; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2
by a3n 10y ago
> my @values = [1 .. 20];
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> say @values[0,2,4 ... *];
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Wall says this should print all the evens, but it prints all (this is in the perl6 repl).
- JadeNB 10y agoWhich version are you using? I happen to have 2016.04 installed: $ perl6 -v This is Rakudo version 2016.04 built on MoarVM version 2016.04 implementing Perl 6.c. and I see: > my @values = [ 1 .. 20 ]; [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] > say @values[0, 2, 4 ... *]; (1 3 5 7 9 11 13 15 17 19) (Of course it's the odd numbers, not the even numbers, but it just happens that the odd-valued entries are in the even-indexed positions in this list.)
- a3n 10y agoperl6 --version This is perl6 version 2013.12 built on parrot 5.9.0 revision 0 Installed from the Mint/Ubuntu/... repository. Wow, that's really old. Is there anything like Python's Anaconda, but for Perl6?
- liveoneggs 10y agotry rakudobrew or just building it yourself from rakudostar
- a3n 10y agorakudobrew worked fine, thanks.