Scala/Currying

From wikipedia: In mathematics and computer science, currying [schönfinkeling ] is the technique of transforming a function that takes multiple arguments (or a tuple of arguments) in such a way that it can be called as a chain of functions, each with a single argument (partial application). It was originated by Moses Schönfinkel and later worked out by Haskell Curry.

Functional languages allow the partial application of functions with currying, for example we can currify operators:

And the result of  will be 12.

This allows defining new functions easily by passing only some of the arguments that the curried function needs. These functions are normal functions that can be used in any other higher order function (e.g. map).

Here are some examples of curried function definitions and invocations:

Note that the function  is not curried but we can create a curried function by specifying an empty parameters  indicating their type.