Currying

In mathematics and computer science, currying is the technique of converting a function that takes multiple arguments into a sequence of functions that each takes a single argument. For example, currying a function that takes three arguments creates three functions:

Or more abstractly, a function that takes two arguments, one from and one from  and produces outputs in by currying is translated into a function that takes a single argument from and produces as outputs functions from to  Currying is related to, but not the same as, partial application.

Currying is useful in both practical and theoretical settings. In functional programming languages, and many others, it provides a way of automatically managing how arguments are passed to functions and exceptions. In theoretical computer science, it provides a way to study functions with multiple arguments in simpler theoretical models which provide only one argument. The most general setting for the strict notion of currying and uncurrying is in the closed monoidal categories, which underpins a vast generalization of the Curry–Howard correspondence of proofs and programs to a correspondence with many other structures, including quantum mechanics, cobordisms and string theory.It was introduced by Gottlob Frege,developed by Moses Schönfinkel,and further developed by Haskell Curry.

Uncurrying is the dual transformation to currying, and can be seen as a form of defunctionalization. It takes a function whose return value is another function and yields a new function that takes as parameters the arguments for both  and and returns, as a result, the application of and subsequently, to those arguments. The process can be iterated.
Posted on by