Join not in Enumerable

I don't think an inifinite collection is a legitimate
enumerable. Since each is an infinite loop, none of the
Enumerable methods will necessarily escape that loop.
Enumerable#find (and friends) may return if it finds a match
since it probably breaks from the loop, but I don't think you
should depend on the implementation breaking from the loop (it
could simply record the first match).

I still think that any array method that is read-only and
operates in a single forward pass over an array would be good
to consider to go into Enumerable (Enumerable#sort* doesn't
meet those qualifications and I don't think it should have been
in there in the first place). But, even without doing this
enum.to_a.<array_method> should work just fine.

Yahoo! Mail
Stay connected, organized, and protected. Take the tour:


--- "David A. Black" <> wrote:

Size has the other problem too: being enumerable does not
mean being
measurable. For example:

   class C
     include Enumerable
     def each
       loop { yield rand(100) }

It's meaningless to talk about the size of a C object -- but
it's a
perfectly legitimate enumerable.