There is a way to get an actual reference to curriedSum’s “second”
function. You can use the placeholder notation to use curriedSum in a partially applied function expression, like this:
scala> val onePlus = curriedSum(1)_
onePlus: (Int) => Int = <function1>
The underscore in curriedSum(1)_ is a placeholder for the second parameter list. The result is a reference to a function that, when invoked, adds one
to its sole Int argument and returns the result:
Login in to like
Login in to comment