Re: n-dim matrices
[email protected] (Christian Soeller) Fri, 01 Sep 2000 08:10:16 +1200
| Newsgroups | perl.perl6.language.data |
|---|---|
| Organization | University of Auckland |
| Message-ID | <[email protected]> |
Karl Glazebrook wrote: > This also addresses one pain in current PDL which is the > difficulty of multi-dim indexing. I like it, too ;) > > print $a[[0,0,0]]; # literal ref list > > print $a[0;0;0]; # literal singleton ; list > > print $a[[$y,$y,$y]]; # variable-based ref list > > print $a[$y;$y;$y]; # variable-based singleton ; list > > print $a[[@lorigin]]; # ref to copy of array variable > > print $a[\@lorigin]; # ref of array variable > > print $a[$rorigin]; # ref variable > > print $a[diagonal(0)];# function that returns array ref > > > > There... 8 ways to do it... > > Do we really need 8 ways? No, at least 18. One more piece of semantics that would be appreciated is optional omission of trailing dimensions in slices, e.g. for a 3-dim @a: @a[0:1] == @a[0:1;] == @a[0:1;;] Christian