Since Kotlin supports many concepts from functional programming, I was wondering if there is a way to do partial application of a function in Kotlin as well?
部分应用可能有用的一个这样的示例是:
// In one class
fun doSomething(cb: (a, b) -> Unit) {
<some logic here to compute someField>
doSomethingElse(cb.applyPartially(someField))
}
// In another class
fun doSomethingElse(cb: (b) -> Unit) {
<some logic here to compute someOtherField>
cb(someOtherField)
}