From: Martin DeMello Date: 2009-03-08T02:12:29+09:00 Subject: Re: how to un-ragged a 2D array? On Sat, Mar 7, 2009 at 9:48 PM, Phlip wrote: > Rubies: > > Here's a ragged array: > >  [ [ 1    ], >   [ 2, 3 ], >   [ 4    ], >   [ 5, 6 ], >   [ 7    ], >   [ 8    ] ] > > How, with the tightest, or most modern, or coolest statements, can we turn > it into this? > >  [ [ 1, 1 ], >   [ 2, 3 ], >   [ 4, 4 ], >   [ 5, 6 ], >   [ 7, 7 ], >   [ 8, 8 ] ] a.each {|i| i[1] ||= i[0]} martin