[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl6-language
Subject:    Re: Array Dimensionality
From:       yary <not.com () gmail ! com>
Date:       2009-06-18 22:53:09
Message-ID: 75cbfa570906181553s454f2299r9521e9512d3248bb () mail ! gmail ! com
[Download RAW message or body]

Apologies for the long post with mistakes in it. I'm going to try
again, biting off less.

my @g[2;2];
@g[0;0]='r0c0';
@g[0;1]='r0c1';
@g[1;0]='r1c0';
@g[1;1]='r1c1';

@g[1] is <r1c0 r1c1> due to S09:

Multi-dimensional arrays, on the other hand, know how to handle a
multidimensional slice, with one subslice for each dimension. You need
not specify all the dimensions; if you don't, the unspecified
dimensions are "wildcarded".

@g[1] becomes @g[1;*] which is ('r1c0', 'r1c1')
(@g[1])[1] is then 'r1c1', which is the same result as @g[1;1]

Using that logic, I can't think of a case where @a[1;1;1] means
something different from ((@a[1])[1])[1]. @a[1] will become @a[1;*;*]
producing a 2d slice of the "2nd row" plane, then we get the "2nd to
the right" column of that from the next slice, and finally the "2nd
back" element of that.

In fact I'd suggest that 'unspecified dimensions are "wildcarded"'
means we don't need the "Cascaded subscripting of multidimensional
arrays" section.

I'd still like to have an error or warning on treating a multi-D array
as an array of arrays.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic