tags:

views:

90

answers:

1

Is there a standard method to create a new array from a two dimensional array so that array[x][y] would be accessed as [y][x] on the new array?

For example, from:

[ [00,01,02,03,04,05],
  [10,11,12,13,14,15],
  [20,21,22,23,24,25] ]

Would become:

[ [00,10,20],
  [01,11,21],
  [02,12,22],
  [03,13,23],
  [04,14,24],
  [05,15,25] ]
+6  A: 

I believe you are looking for Array#transpose

Ed Swangren