在 Swift 4 中,我如何 curry func 并保留参数标签/名称:
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
来自这里的答案Curry Function in Swift
和https://robots.thoughtbot.com/introduction-to-function-currying-in-swift
我可以,但是标签被省略了
let curryDo = curry(doSomething)
let doA = curryDo(value_a) // but the a label is removed here.
如何在柯里化函数中保留参数标签/名称?