0

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?

tuledev
  • 10,177
  • 4
  • 29
  • 49

1 Answers1

1

Swift removed currying as a feature in version 3, and all current implementations use closures, which don't have labeled arguments.

Avi
  • 7,469
  • 2
  • 21
  • 22