tags:

views:

38

answers:

1

I'm trying to convert this:

[ [1, 2, 3, 4],
  [5, 6, 7, 8],
  [9, 10, 11, 12] ]

into this:

[ [1, 5, 9],
  [2, 6, 10],
  [3, 7, 11],
  [4, 8, 12] ]

Is there a build-in function to do this? If it's not, what's the shorter and cleaner way?

+6  A: 

Array#transpose

skalee