On Tuesday 11 January 2005 10:06 pm, Dave Whipp wrote: > We know that > > @a = (1, 2, 3); > $b = @a[1]; > > Loses the dimension as a DWIM. > > So perhaps we could say that assigning to a lower dimension always gets > rid of a dimension of size 1 -- or error if it can't: > > @c = ( 1,2,3 ; 4,5,6 ); > @d[*;*] = @c[ 1 ; * ]; # @d is 2d > @e[*] = @c[ 1 ; * ]; # @e is 1d > @f = @c[1;1]; # @f is 2d: no dimensions lost
Hmmm.... I'm sorry, but I'm not quite following what you mean by the '=' in this case. I've been thinking of '=' as a full-on, dimensional-context-free assignment, and of ':=' as a shaped, elementwise assignment, by analogy to the current perl5/PDL setup. In that paradigm, "@e[*] = @c[1;*]" doesn't mean anything, since the LHS isn't really a full-on lvalue -- it's an array slice with (already) a definite shape (an "l2value"?). But I could just be confused about intent here. I'm used to thinking of piddles, which are pretty regimented -- they have a definite size along each axis. Do perl6 multi-dimensional arrays have definite sizes, or are they "just" lists of lists of whatevers, under the hood? Each of those structures would be very useful for an almost completely different set of things. I guess Larry was right when he hinted that there're still dragons here... so, er, sorry to have opened a can of wyrms...