On Mar 5, 2014, at 0:57, Heesob Park <phasis / gmail.com> wrote:

> I found a bit more compact and efficient way
>=20
> irb(main):037:0> arr.partition.with_index{|x,i|i.odd?}
> =3D> [[11, :true, -22, [], "n"], [12, "a", 300, {}, "n-1"]]

Doing an #odd? test on each iteration for such a task is wasteful. You =
know ahead of time if it is even or odd.

  even, odd =3D arr.each_slice(2).to_a.transpose