You can emulate it with a closure

func myFunc(a: Int, b: Int, c: Int) -> Int { return a + b + c }

let partial = { (b) -> Int in return myFunc(a: 5, b: b, c: 7) }
let ans = partial(6) // 18

It’s not ideal because you lose the argument label, but I think they’re going 
to fix that one day.

> On 6 Oct 2016, at 01:50, Jonathan Hull via swift-evolution 
> <[email protected]> wrote:
> 
> Erica’s thread on currying made me remember a (very) early discussion on the 
> topic where currying was being removed temporarily in hopes that partial 
> application could be added back in later with better syntax.
> 
> I would really like to be able to do the following:
> 
>       let partial = myFunc(a: 5, b: _, c: 7)
>       let ans = partial(b: 6)
> 
> Thanks,
> Jon
> _______________________________________________
> 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