Reputation: 10317
In Swift 4, how can I curry func, and keep param label/ name:
func doSomething(a: A, b: B, c: C) {
}
let do_a = doSomething(a: value_a) // keep name a
let do_ab = do_a(b: value_b) // keep name b
let result = do_ab(c: value_c) // keep name c
With the answer from here Curry Function in Swift
And https://robots.thoughtbot.com/introduction-to-function-currying-in-swift
I can do, but the label is omitted
let curryDo = curry(doSomething)
let doA = curryDo(value_a) // but the a label is removed here.
How to keep param label/name in currying func?
Upvotes: 0
Views: 73
Reputation: 7552
Swift removed currying as a feature in version 3, and all current implementations use closures, which don't have labeled arguments.
Upvotes: 1