Feels like worthy of making an issue for this to me.

> On 16 Aug 2019, at 12:18, Sean McAfee <eef...@gmail.com> 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 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 when I tried to clean up my code a bit, it broke.
> 
> > my @index = map { $_, $_ + 1 }, ^9
> [(0 1) (1 2) (2 3) (3 4) (4 5) (5 6) (6 7) (7 8) (8 9)]
> > @array[@index]
> (7 7 7 7 7 7 7 7 7)
> 
> Weird.  But map returns a Seq, right?  So maybe...
> 
> > @array[@index.Seq]
> (7 7 7 7 7 7 7 7 7)
> 
> Hmm.  How about:
> 
> > @array[@index.List]
> ((9 8) (8 7) (7 6) (6 5) (5 4) (4 3) (3 2) (2 1) (1 0))
> 
> That works again.  But why?  Is this the intended behavior?  If so, is it 
> documented somwhere?
> 

Reply via email to