[swift-evolution] [Accepted with revisions] SE-0187 “Introduce Sequence.filterMap(_:)”

John McCall rjmccall at apple.com
Tue Dec 19 10:55:58 CST 2017

Hi, Swift community!  I apologize for the delay in reporting our decision here; between one holiday and the other, it took awhile for the core team to assemble a quorum to talk through this.

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md <https://github.com/apple/swift-evolution/blob/master/proposals/0187-introduce-filtermap.md>

The second review of SE-0187 “Introduce Sequence.filterMap(_:)” ran from November 15...20, 2017.  The result of the first review was consensus to rename the method, and the purpose of the second review was to get more specific feedback on what the new name should be.

"filterMap" is a name with some precedent in other programming languages, especially functional ones, but some people felt strongly that the name was misleading because, as a combined operation, it wasn't quite a filter or a map.  Of the alternatives, the one with the strongest support seemed to be "compactMap", which builds on the precedent of "compact", an operation from other languages (notably Ruby) which returns a copy of the input without nil values.  Swift does not currently have such an operation, and in fact it is not currently possible to express it; nonetheless, the core team agrees that it would be a reasonable operation to add, and that "compactMap" is a good name for the operation.

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.

Thank you all for your continued contributions to making Swift a better language.

John McCall
Review Manager 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171219/246b2be4/attachment.html>

More information about the swift-evolution mailing list