【发布时间】:2018-05-23 07:14:18
【问题描述】:
在 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.
如何在柯里化函数中保留参数标签/名称?
【问题讨论】:
标签: swift functional-programming currying