[swift-evolution] Brainstorming: Optional sugar inferred map

Craig Cruden ccruden at novafore.com
Sat Jan 30 03:40:31 CST 2016


The for translates into:

o1.flatMap(x => o2.map(y => manager.doSumething(data, x, y)))

> On 2016-01-30, at 6:15:18, Craig Cruden <ccruden at novafore.com> wrote:
> 
> I would think it would be functionally equivalent to Scala.
> 
> for {
>    o1 <- optional1
>    o2 <- optional2
>    ..
> } yield { manager.doSumething(data, o1, o2) }
> 
> which is a combination of maps and flatMaps.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160130/102639f0/attachment.html>


More information about the swift-evolution mailing list