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@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@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