+1 for .mapCompacting
> On Dec 21, 2017, at 8:49 PM, Erica Sadun via swift-evolution > <swift-evolution@swift.org> wrote: > > > >>> On Dec 19, 2017, at 4:42 PM, Dave Abrahams via swift-evolution >>> <swift-evolution@swift.org> wrote: >>> >>> >>> >>> On Dec 19, 2017, at 2:28 PM, Xiaodi Wu via swift-evolution >>> <swift-evolution@swift.org> wrote: >>> >>> I disagree. Let’s not reopen what is settled. “Compact” can be a noun just >>> as “map” and “filter” can; as long as there are no in-place variants, there >>> can be no ambiguity. >>> On Tue, Dec 19, 2017 at 17:11 Brent Royal-Gordon via swift-evolution >>> <swift-evolution@swift.org> wrote: >>>>> On Dec 19, 2017, at 8:56 AM, John McCall <rjmcc...@apple.com> wrote: >>>>> >>>>> Therefore, SE-0187 is accepted, with the revision that the new name be >>>>> Sequence.compactMap(_:), and with the agreement that we will add >>>>> Sequence.compact() when it is possible to do so. >>>> >>>> >>>> I like `compact` as the basis for the name, but I hope the core team will >>>> consider whether the eventual nil-removal method should be called >>>> `compacting()`, and whether therefore this method should be called >>>> `compactingMap(_:)`. Prior art on the name `compact()` does exist, but I >>>> don't think it's strong enough to justify deviating from the API >>>> Guidelines. >>>> >>>> I don't think we need a full review on this tiny issue; five minutes of >>>> the core team's time should more than suffice. >> >> I agree with Brent. IMO we're firmly outside the domain of established >> terms-of-art here (Ruby notwithstanding). > > I lean slightly towards "but they already have been through this", but given > that the core term is "compact" and it is secondary to map, then I think > `mapCompacting` is superior: > > * It mirrors the process better (apply function, then decide whether to > include or exclude the result) > * It prefers `compacting` as Brent points out, supporting the Swift API > Guidelines > * It uses the term of art `map` consistently with this preferred term. > * It places the two names closer together in autocomplete > > -- E, hiding the bikeshed paintbrush behind her back > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution