Putting this in a new thread, as I'd like to discuss it separately from refinements to Array.rotate
On Fri, Jun 12, 2009 at 10:11 AM, Jon Lang<datawea...@gmail.com> wrote: > With a multi-dimensional array, a number of transforms can be considered: > > * you can rearrange the elements along a given dimension (e.g., rotate > and reverse). Hmm, we have an Array.reverse already, which I think flattens a multi-D array before reversing it. Maybe it could take an adverb (:by ?) to let you specify which dimension(s) to reverse, though I can't think of anything satisfactory to specify an axis set. Or maybe there's a "reflect" method on Array for reversing along an axis, or axes. > * you can rearrange the dimensions themselves (e.g., transpose). Reflecting on 2 or more axes creates a transposition. Maybe it makes sense to have a separate transpose, defined in terms of reflection. There's still more reshaping possibilities, some of which is already easy eg my @tall[2;8] = (1 .. 16); # tall (1,2; 3,4 ; 5,6; ... etc) my @wide[8;2...@tall; # I think wide is (1 .. 8; 9 ..16)