Re: reshape() (was Re: Fw: Wrapup time)
[email protected] ("Jeremy Howard") Thu, 14 Sep 2000 13:02:49 +1100
| Newsgroups | perl.perl6.language.data |
|---|---|
| Message-ID | <[email protected]> |
> > rather use a transpose() function for this that can transpose across a given > > axis. > > You'll be RFC'ing that, I suppose? ;-) (But seriously, it sounds like a > good idea) > Yes, I will. > > I don't think we need to define the ability to work on multiple lists as > > special behaviour. Perl knows how to flatten lists, so any syntax we define > > will allow multiple lists simply by letting Perl join and flatten them. > > Right, unless you make the list the first argument, like NumPy: > > @b = rehape @a, [1,2]; > > Then you're in trouble. > So we shouldn't make the list the first argument... > > Finally, I think the dimensions specified by reshape() should be the maximum > > index of the axis, not the number of elements, since this way it matches the > > :bounds semantics. In this case, the wildcard would clearly need to -1. > > This sounds reasonable, but maybe just clarify this a little? Feel free > to send me volumes of examples offline if need be. > RFC 203 defines a :bounds attribute that defines the maximum index of each dimension of an array. RFC 206 provides the syntax @#array which returns these maximum indexes. For consistancy, the arguments to reshape() should be the maximum index of each dimension. A maximum index of '0' would mean that that dimension is 1 element wide. Therefore '0' can not be special in reshape(). Therefore we should use '-1'. Let me know off-list if you'd like more clarification.