2013/10/3 marcandre (Marc-Andre Lafortune) <ruby-core / marc-andre.ca>:
> Issue #8840 has been updated by marcandre (Marc-Andre Lafortune).
>
>
> akr (Akira Tanaka) wrote:
>> Would you explain the incompleteness concretely?
>
> Sure. With your code above:
>
>     e.drop2(40).map(&:odd?) # => [true, false]
>     # expected lazy enumerator, as with original drop:
>     e.drop(40).map(&:odd?)  # => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 1..42>:drop(40)>:map>
>
> Here is another implementation using `with_state` that returns a lazy enumerator:
>
>     class Enumerator::Lazy
>       def drop3(n)
>         Lazy.new(with_state(remain: n)) do |y, (state, v)|
>           if state[:remain] == 0
>             y.yield v
>           else
>             state[:remain] -= 1
>           end
>         end
>       end
>     end
>
> This implementation doesn't look so bad. It's probably quite a bit slower than using a Yielder#state method though.

Thank you.  I understand.

I still like with_state than Yielder#state
because it limits stateful behaviors into a method.
-- 
Tanaka Akira