Re: [swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

2017-11-09 Thread Sam Warner via swift-evolution
What I meant by flagging the renaming of the generic `flatMap` to the more specific-to-this-case `filterMap` is that all of the current uses of `flatMap` share conceptual details: they all process whatever is in the box, then perform one level of flattening. This shared concept is hugely

Re: [swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

2017-11-09 Thread Ben Cohen via swift-evolution
> On Nov 9, 2017, at 11:43 AM, Vladimir.S via swift-evolution > wrote: > > let a : [Int?] = [1,2,3,nil,4,nil,5] > > let b = a.flatMap { $0.flatMap{$0*10} } // current At the risk of taking us further down the rabbit hole… You really want: let b = a.flatMap {

Re: [swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

2017-11-09 Thread Vladimir.S via swift-evolution
On 09.11.2017 19:41, BJ Homer via swift-evolution wrote: On Nov 9, 2017, at 9:37 AM, Sam Warner via swift-evolution wrote: I accept the motivation for this change, although I would mention that: - in 2.5 years on a ~200k lines of Swift project - we've seen a

Re: [swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

2017-11-09 Thread BJ Homer via swift-evolution
> > On Nov 9, 2017, at 11:35 AM, Tino Heth <2...@gmx.de> wrote: > > >> This proposal only proposes renaming the “filterNonesAndMap” variant (though >> that name is misleading, it would be “filterNonesAfterMapping” if anything); >> the other uses of flatMap will remain unchanged. > … then it

Re: [swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

2017-11-09 Thread Tino Heth via swift-evolution
> This proposal only proposes renaming the “filterNonesAndMap” variant (though > that name is misleading, it would be “filterNonesAfterMapping” if anything); > the other uses of flatMap will remain unchanged. … then it should be really right: As I learned in the thread, there is a map step

Re: [swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

2017-11-09 Thread BJ Homer via swift-evolution
> On Nov 9, 2017, at 9:37 AM, Sam Warner via swift-evolution > wrote: > > I accept the motivation for this change, although I would mention that: > - in 2.5 years on a ~200k lines of Swift project > - we've seen a plenty of instances of `flatMap` used where `map`

[swift-evolution] SE-0187: Introduce Sequence.filterMap(_:)

2017-11-09 Thread Sam Warner via swift-evolution
I accept the motivation for this change, although I would mention that: - in 2.5 years on a ~200k lines of Swift project - we've seen a plenty of instances of `flatMap` used where `map` would have been sufficient, but - we've never burned time on tracking down the sort of compiler issue described