From: William James Date: 2005-08-29T16:36:22+09:00 Subject: Re: how to unflatten a flat-array SHIGETOMI, Takuhiko wrote: > dear guys, > > i am seeking a smart way to do ... > > [ 1, 2, 3, 4, 5, 6, ... ] => [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], ... ] > > especialy, the way hopefully will work safety when the source array's > size is odd or zero. ary = [1,2,3,4,5,6,7,8] f=nil t=ary.partition{f=!f} p t[0].zip(t[1])