I've been looking at the PP's Guide and I can't seem to see it in there. (http://www.rubycentral.com/book/builtins.html) Are there any other sources for knowing builtin classes/modules? still new, db On Thu, Aug 01, 2002 at 01:47:55AM +0900, Daniel Bretoi wrote: > Sorry all, I actually checked for a matrix class, but I must have missed > it (. Anyway, what I would be interested in is how you would approach the > problem WITHOUT using the matrix class. > > db > > On Thu, Aug 01, 2002 at 01:39:16AM +0900, Ville Mattila wrote: > > 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 > > -- > "Then we typed the G, and the system crashed"... -- "Then we typed the G, and the system crashed"...