Re: Subscripting with a list of slices

2019-08-16 Thread William Michels via perl6-users
It looks like it works if you call the .Seq method on a scalar $index : > my @array = 9 ... 0 [9 8 7 6 5 4 3 2 1 0] > my $index = map { $_, $_ + 1 }, ^9 ((0 1) (1 2) (2 3) (3 4) (4 5) (5 6) (6 7) (7 8) (8 9)) > say @array[$index.Seq] ((9 8) (8 7) (7 6) (6 5) (5 4) (4 3) (3 2) (2 1) (1 0)) > put

Re: Subscripting with a list of slices

2019-08-16 Thread Elizabeth Mattijsen
Feels like worthy of making an issue for this to me. > On 16 Aug 2019, at 12:18, Sean McAfee wrote: > > Today I was surprised and pleased to find that I could apparently subscript > an array with a list of lists of indices, and get a list of slices back: > > > my @array = 9 ... 0 > [9 8 7 6 5

Subscripting with a list of slices

2019-08-16 Thread Sean McAfee
Today I was surprised and pleased to find that I could apparently subscript an array with a list of lists of indices, and get a list of slices back: > my @array = 9 ... 0 [9 8 7 6 5 4 3 2 1 0] > @array[map { $_, $_ + 1 }, ^9] ((9 8) (8 7) (7 6) (6 5) (5 4) (4 3) (3 2) (2 1) (1 0)) Neat! But