From: mame@... Date: 2020-11-16T08:24:22+00:00 Subject: [ruby-core:100869] [Ruby master Feature#17312] New methods in Enumerable and Enumerator::Lazy: flatten, product, compact Issue #17312 has been updated by mame (Yusuke Endoh). I think `Enumerable#compact` is trivial and maybe useful. In regard to `Enumrable#flatten`, I agree with @Dan0042's concern. I think that it should flatten only Array elements, but it might look unnatural. I'm unsure if `Enumerable#product` is useful. Its arguments are repeatedly iterated, so the arguments should be Arrays? It would be good to separate tickets for each method, and a draft patch would be helpful for discussion. ---------------------------------------- Feature #17312: New methods in Enumerable and Enumerator::Lazy: flatten, product, compact https://bugs.ruby-lang.org/issues/17312#change-88516 * Author: zverok (Victor Shepelev) * Status: Open * Priority: Normal ---------------------------------------- (The offspring of #16987, which was too vague/philosophical) I propose to add to `Enumerable` and `Enumerator::Lazy` the following methods: * `compact` * `product` * `flatten` All of them can be performed with a one-way enumerator. All of them make sense for situations other than "just an array". All of them can be used for processing large sequences, and therefore meaningful to add to `Lazy`. -- https://bugs.ruby-lang.org/ Unsubscribe: