T
trans. (T. Onoma)
Are Enumerator#each_slice and #enum_slice properly named? All they take is an
integer which groups the enumerator's elements:
[1,2,3,4,5,6].to_enum.enum_slice(2).to_a
#=> [[1,2],[3,4],[5,6]]
Yet Array#slice does nothing of the sort:
[1,2,3,4,5,6].slice(2)
#=> 3
Also, how does one achieve #enum_slice functionality without Enumerator using
only Array?
T.
integer which groups the enumerator's elements:
[1,2,3,4,5,6].to_enum.enum_slice(2).to_a
#=> [[1,2],[3,4],[5,6]]
Yet Array#slice does nothing of the sort:
[1,2,3,4,5,6].slice(2)
#=> 3
Also, how does one achieve #enum_slice functionality without Enumerator using
only Array?
T.