Re: n-dim matrices
[email protected] ("Jeremy Howard") Thu, 31 Aug 2000 16:20:32 +1100
| Newsgroups | perl.perl6.language.data |
|---|---|
| Message-ID | <[email protected]> |
Christian Soeller wrote: > Jeremy Howard wrote: > > > 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 > > A possible approach. Two issues: (1) others might argue that we should > use a multiplication like operator, e.g. x. Call it a separator and no > such discussion would arise. It would be nice to think Perl people were more open-minded ;-) Making the result of ';' a real data structure would mean you could create n-dim slices once and re-use them later. It also unifies the notations quite nicely. > (2) lazy evaluation is again critical: we > don't want (10:100000; 0:1000) create a huge list in memory. So now we > have a lazy list made up of two other lazy lists. Possible I guess. > It sure is. My list generation RFC already specifies this: <quote> =head1 ABSTRACT This RFC proposes that the existing C<..> operator produce a lazily evaluated list. In addition, a new operation C<:> is proposed that allows for the generation of lazily evaluated lists based on any Perl expression. </quote> This would be a natural place to add ';' as part of the lazy list generation tool-box.