Actions
Bug #6142
closedEnumerable::Lazy#zip doesn't rewind internal enumerators
Description
All enumerables passed to Enumerable::Lazy#zip are converted into lazy enumerators.
When result evaluated - ruby iterates over this enumerators while calling #next to retrieve the next value.
But those enumerators are not rewinded:
a = (1..3).lazy.zip('a'..'z')
a.to_a #=> [[1, "a"], [2, "b"], [3, "c"]]
a.to_a #=> [[1, "d"], [2, "e"], [3, "f"]]
I believe that is not the desired behavior here and a.to_a should always return the same value.
Files
Actions
Like0
Like0Like0Like0Like0Like0