Actions
Bug #7343
closedEnumerator::Lazy seems to nest herself infinitely
Description
Hello, Ruby dev team.
I tried Ruby 2.0 trunk, and found Enumerator::Lazy a bit weird.
> [1, 2, 3].cycle.lazy.take 5
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: [1, 2, 3]:cycle>>:take(5)>
> [1, 2, 3].cycle.lazy.take_while {|i| i < 3 }.lazy.take(2)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: [1, 2, 3]:cycle>>:take_while>:take(2)>
> [1, 2, 3].cycle.lazy.take_while {|i| i < 3 }.lazy.take(2).lazy.take(3).lazy
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: [1, 2, 3]:cycle>>:take_while>:take(2)>:take(3)>
Is this type of infinite nesting desirable?
Thank you,
Uchio KONDOudzura@udzura.jp
Actions
Like0
Like0Like0