Daniel Bretoi <lists / debonair.net> writes:

> Hi all,
> 
> 	I'd like to see the various solutions for coming up with code to
> 	transpose a matrix. ie. make 
> 
> 	a = [[1,2],[1,3],[2,4]]
> 
> 	look like
> 
> 	aT = [[1,1,2],[2,3,4]]
> 
> 	I haven't had time to do a solution myself, but I think it would be
> 	interesting to see how some of you guys would tackle it while I
> 	derive something.

irb
irb(main):001:0> require 'matrix'
true
irb(main):002:0> foo = Matrix[ [1,2],[1,3],[2,4]]
Matrix[[1, 2], [1, 3], [2, 4]]
irb(main):003:0> foo.transpose
Matrix[[1, 1, 2], [2, 3, 4]]
irb(main):004:0>

        That wasn't so hard.

 - Ville