Re: n-dim matrices
[email protected] ("Jeremy Howard") Thu, 31 Aug 2000 15:10:32 +1100
| Newsgroups | perl.perl6.language.data |
|---|---|
| Message-ID | <[email protected]> |
Christian Soeller wrote: > I think a combination of yours and Budda's proposal is actually very > nice: > > @a[10:20:2; 11:30:3]; # ; implies cartesian product of indices > @a[10..20:2; 11..30:3]; # same with .. syntax > @a[[10,20,2],[@index], [0,0,0]] # comma-separated index refs means > # individual elements > > Is that a possible compromise? > Actually, it's not just a compromise, it's an extension. I was thinking that: @a[10:20:2][11:30:3]; would not be a cartesian product, but a component-wise list (10,11; 12,14; 14,17;...20,29). What if we created a new operator ';' that works within a list that creates a cartesian product?: (10:20:2; 11:30:3); # Cartesian product of 10:20:2 and 11:30:3 as a LOL Since a list is created automatically within [], this operator plus my existing proposals plus RFC 81 would make your three examples work perfectly. It would also allow my LOL extension syntax.