Hi,

In message "Re: require 'enumerator'"
    on Tue, 2 Nov 2004 13:41:01 +0900, "trans.  (T. Onoma)" <transami / runbox.com> writes:

|Is this right?
|
|irb(main):033:0> (1..10).enum_cons(2).to_a
|=> [[9, 10], [9, 10], [9, 10], [9, 10], [9, 10], [9, 10], [9, 10], [9, 10], 
|[9, 10]]

Here's the explanation:

enum_cons() gathers values generated by each_cons().  each_cons()
passes same array modifying for each time.  Thus all elements in the
to_a array refers to the same array, thus it seems that all elements
are [9,10].

I'm not sure yet how it should behave.  Perhaps it should copy
returning arrays somewhere.

							matz.