From: "jeremyevans0 (Jeremy Evans) via ruby-core" Date: 2024-07-19T21:18:24+00:00 Subject: [ruby-core:118640] [Ruby master Bug#20623] Unexpected behavior of blocks in Enumerator::Lazy#zip Issue #20623 has been updated by jeremyevans0 (Jeremy Evans). I submitted a pull request to fix this: https://github.com/ruby/ruby/pull/11212 ---------------------------------------- Bug #20623: Unexpected behavior of blocks in Enumerator::Lazy#zip https://bugs.ruby-lang.org/issues/20623#change-109167 * 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/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/