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

swift at lng.la swift at lng.la
Tue Dec 19 13:15:26 CST 2017


Happy to hear that we went in this direction! Looking forward to the compact method as well.

Jarod

On Dec 19, 2017, 08:56 -0800, John McCall via swift-evolution <swift-evolution at swift.org>, wrote:
> 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
>
> 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/38ea7150/attachment.html>


More information about the swift-evolution mailing list