[ruby-core:102750] [Ruby master Feature#17347] Enumerator::Chain of Enumerator::Lazy should be lazy
From:
merch-redmine@...
Date:
2021-03-05 22:37:36 UTC
List:
ruby-core #102750
Issue #17347 has been updated by jeremyevans0 (Jeremy Evans). This isn't a duplicate of #17216 even though it is related. I agree that this feature would be useful. I've included an implementation in the same pull request: https://github.com/ruby/ruby/pull/3811 ---------------------------------------- Feature #17347: Enumerator::Chain of Enumerator::Lazy should be lazy https://bugs.ruby-lang.org/issues/17347#change-90762 * Author: asilano (Chris Howlett) * Status: Open * Priority: Normal ---------------------------------------- ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux] Consider the following script: ``` ruby a = [1,2,3].lazy p a b = [4,5,6].lazy p b c = a + b p c ``` This gives the output: ``` #<Enumerator::Lazy: [1, 2, 3]> #<Enumerator::Lazy: [4, 5, 6]> #<Enumerator::Chain: [#<Enumerator::Lazy: [1, 2, 3]>, #<Enumerator::Lazy: [4, 5, 6]>]> ``` Note that `c` is just `Enumerator::Chain`; but all its component enumerators are lazy, so it would be nice if `c` were lazy. That is, I'd like the output to be: ``` #<Enumerator::Lazy: [1, 2, 3]> #<Enumerator::Lazy: [4, 5, 6]> #<Enumerator::Lazy: #<Enumerator::Chain: [#<Enumerator::Lazy: [1, 2, 3]>, #<Enumerator::Lazy: [4, 5, 6]>]>> ``` -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>