What about:
[1, 2, 3].to_enum.lazy # => #<Enumerator::Lazy: ...>
In fact, but the problem is that I start with an enumerator, not an array
This does not change anything:
enum = (1..10).each # => #<Enumerator: ...> enum.lazy # => #<Enumerator::Lazy: ...>
Enumerable#to_enum returns a counter. If you call the call on Enumerable#lazy , the receiver of the second message is the Enumerator returned by the first call.
tompave
source share