On Mar 27, 2006, at 9:59 PM, Farrel Lifson wrote:

> Is there an easy way to get [1,2,3,4,5,6,7,8] into
> [[1,2],[3,4],[5,6],[7,9]] or [[1,2,3,4],[5,6,7,8]] depending on a
> parameter?

require 'enumerator'

[1,2,3,4,5,6,7,8].enum_for(:each_slice, 4).to_a # -> [[1, 2, 3, 4],  
[5, 6, 7, 8]]

-- Daniel