Simon Kröger
9/17/2007 8:09:00 PM
Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: group array elements in groups of two"
> on Tue, 18 Sep 2007 01:10:10 +0900, William James <w_a_x_man@yahoo.com> writes:
>
> |Nirvana at last! I won a round of golf with
> |Matz!
> |
> |YM: .to_enum(:each_slice, 2).to_a
> |WJ: .enum_slice(2).to_a
>
> Well done, but your version does not work on 1.8. ;-)
>
> matz.
Will the world stop turning or am i just trapped in a parallel universe?
$ ruby -v -renumerator -e "p [1,2,3,4,5,6,7,8,9,0].enum_slice(2).to_a"
ruby 1.8.4 (2005-12-24) [i386-cygwin]
[[1, 2], [3, 4], [5, 6], [7, 8], [9, 0]]
cheers
Simon