currying
Currying is the technique of emulating multiple-parameteredfunctions with higher-order functions. The notion is that a functionof arguments can be thought of as a function of 1 argument thatmaps to a function of arguments. A curried function is afunction represented by currying, e.g.
For conciseness, the mapping operator is usuallyconsidered right-associative, so one could drop the parentheses in theexpression above and write instead.
In contrast, an uncurried function is usually specified as amapping from a Cartesian product, such as
The term currying is derived from the name of Haskell Curry, a20th-century logician. However, Curry was not the first person todiscover this notion, as it was first introduced by Gottlob Frege in1893 and expanded by Moses Schönfinkel in the 1920s. Hence thenotion is sometimes referred to as schönfinkeling.
From the perspective of category theory, currying can be thought of asexploiting the fact that and are adjointfunctors
on . That is, for each set , there is a naturalequivalence
defined by sending a map to the map. For each , is the map defined by .