[EMAIL PROTECTED] wrote:
> Reading through the examples left me wondering about some
> technicalities:
>
> > @t[|i;|j] = @a[|j;|i]; # transpose 2-d @a
>
> Written like this it would require that @a is exact 2-dim, i.e. it would
> not just swap the first two dims of any n-dim array? I suppose if I'd
> want that I'd write
>
> @t[|i;|j;] = @a[|j;|i;]; # trailing ';' implies there might be
> trailing dims
>
Not necessary. Since arrays support all the syntax of a plain old list of
lists, and the |i syntax just creates an implicit loop, the example quoted
from the RFC will work with other sized arrays. In fact, if it was only 2d,
it would more properly be:
$t[|i;|j] = $a[|j;|i]; # transpose 2-d @a
With three dimensions, each implicit loop in
@t[|i;|j] = @a[|j;|i]; # transpose 2-d @a
is assigning the _list_ (or 1d array) at @a[|j;|i] to the appropriate index
in @t. Ditto for >3 dimensions, except that it is a >1d array (or LOL) that
is being assigned at each index through the implicit loop.