
Issue #20623 has been reported by esad (Esad Hajdarevic). ---------------------------------------- Bug #20623: Unexpected behavior of blocks in LazyEnumerator#map https://bugs.ruby-lang.org/issues/20623 * Author: esad (Esad Hajdarevic) * Status: Open * ruby -v: 3.3.0 * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I've stumbled upon unexpected behaviour of lazy enumerators. My example: ``` [1].cycle.lazy.zip([2].cycle.lazy).map do |x| puts x.inspect end.take(5).force puts "---" [1].cycle.lazy.zip([2].cycle.lazy).take(5).force.map do |x| puts x.inspect end ``` The outputs (and variable assignment inside the block) differs ``` 1 1 1 1 1 --- [1, 2] [1, 2] [1, 2] [1, 2] [1, 2] ``` -- https://bugs.ruby-lang.org/