Hi,

Paolo Bacchilega <paolo.bacchilega / libero.it> writes:

> Is there a way to split an array in sub arrays of the same length, that
> is :
> 
> [ 1, 2, 3, 4, 5, 6, 7, 8 ].unknown_function(3)
> 
> that returns:
> 
> [ [1, 2, 3], [4, 5, 6], [7, 8] ]

% irb --prompt simple
>> require 'enumerator'
=> true
>> [ 1, 2, 3, 4, 5, 6, 7, 8 ].enum_slice(3).to_a
=> [[1, 2, 3], [4, 5, 6], [7, 8]]

-- 
eban