From: knu@... Date: 2018-10-10T06:12:26+00:00 Subject: [ruby-core:89351] [Ruby trunk Feature#709] Enumerator#+ Issue #709 has been updated by knu (Akinori MUSHA). Description updated I've become positive about this proposal after experiences with potential use cases. In today's developer meeting, Matz approved this proposal, so I'm going to start working on this! ---------------------------------------- Feature #709: Enumerator#+ https://bugs.ruby-lang.org/issues/709#change-74382 * Author: candlerb (Brian Candler) * Status: Rejected * Priority: Normal * Assignee: knu (Akinori MUSHA) * Target version: 2.0.0 ---------------------------------------- =begin Enumerators could be directly composable: class Enumerator def +(other) Enumerator.new do |y| each { |e| y << e } other.each { |e| y << e } end end end if __FILE__ == $0 a = (1..3).to_enum + (10..12).to_enum + (17..20).to_enum a.each { |i| puts i } end The only problem I can see here is that this might open the floodgates to requests for more methods such as & and |, and it's not clear how those would behave. (Personally I'd go for a merge which compares the head items from each of the operands, which assumes that the operands are already in sorted order, but others may disagree) =end -- https://bugs.ruby-lang.org/ Unsubscribe: