On 10.11.2017 18:37, BJ Homer via swift-evolution wrote:


On Nov 10, 2017, at 5:07 AM, Tino Heth <[email protected]> wrote:

A: Well, it does a mapping, and then applies a filter to get rid of nils,

I prefer to think of it this way: it does a mapping, and keeps the results where the 
closure did not return nil. In the example given earlier, the closure returned 
Optional<Int?>.some(nil), which is not “nil”.


"So you can be sure that when you apply the filterMap method, the result doesn’t 
contain any nil values?"

Probably some code like this was shown then?:

let a : [[Int?]] = [[1,2,3,nil],[4,nil,5]]

print(a.flatMap{$0}) // [Optional(1), Optional(2), Optional(3), nil, 
Optional(4), nil, Optional(5)]

-BJ
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to