Re: n-dim matrices
[email protected] (Dan Sugalski) Wed, 30 Aug 2000 21:12:19 -0400 (EDT)
| Newsgroups | perl.perl6.language.data |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 31 Aug 2000, Jeremy Howard wrote: > > To access a single element we want > > > > $a[$i,$j,$k] > > > But this already means "the $i, $j, and $k" elements of a list. It is a very > frequently used construct--I think that changing it will be impossible, and > that creating a new data type that acts contrary to this would be highly > confusing. It doesn't, though. It actually means the $k element of the array $a--for the $i, $j, and $k elements you'd need a @ in front of the slice. > > for a slice we want > > > > $a[10:20:2, 11:30:3] > > > As opposed to: > > $a[[10:20:2], [11:30:3]] > > which is only four keystrokes. Maybe we could define circumstances under > which list generation notation is automatically enreferenced, and then your > preferred notation would work too... Either way, I expect the parser would know what you were doing and Do The Right Thing, though personally I'd rather we didn't overload the LOL syntax this way. (We'll do it if it comes to that, though) You might consider an alternative as part of the RFC that uses new syntax rather than overloading the old. This is just personal preference--I grew up programming in languages that had real multidimensional arrays, and I'd just as soon we added them to perl for real. (Real being in a user-visible sense--I know we'll do it for real under the hood) Dan