[swift-evolution] [Accepted and Focused Re-review] SE-0187: Introduce Sequence.filterMap(_:)
Benjamin G
benjamin.garrigues at gmail.com
Thu Nov 16 05:43:17 CST 2017
I like mapAndUnwrap , but just for the record I'd like to add
"mapThenUnwrap"
I'm not a native english, but i think "and" doesn't convey as much meaning
relative to the order of the operation as "then".
As a sidenote, if we go this road I think flatMap should also be the object
of a renaming proposal. we would have
map,
mapThenFlatten and
mapThenUnwrap.
It doesn't look as functional style programming as flatMap and filterMap ,
but it's IMHO incredibly clearer. I remember being very puzzled by flatMap
the first time is discovered it and its type signature, making me think it
was "a different kind" of map, instead of a map plus something more in the
end of the process.
On Thu, Nov 16, 2017 at 11:23 AM, Jean-Daniel via swift-evolution <
swift-evolution at swift.org> wrote:
>
>
>
> Here's a variety of possible new names, in descending order of personal
> preference:
>
> mapUnwrappingSome
> mapAndUnwrap // Thanks Nevin, this is surprisingly clear.
> mapUnwrapSome
> mapUnwrapIfSome
> mapSome // For these last three, it's unclear when nil elements
> are dropped. Before or after the map?
> mapNonNil
> mapStrippingNil
>
>
> An other explicit alternative
>
> mapIfNotNil()
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171116/74a768d8/attachment.html>
More information about the swift-evolution
mailing list