Currying is the process of transforming a function of multiple arguments into a function of one argument that returns another function, which takes one fewer argument than the original one. Languages such as Haskell use this as the default argument application mechanism, as it makes certain programming techniques, such as partial application, much easier.
Currying is the process of transforming a function of multiple arguments into a function of one argument that returns another function, which takes one fewer argument than the original one. Languages such as haskell use this as the default argument application mechanism, as it makes certain programming techniques, such as partial-application, much easier.
The technique originates in combinatory-logic, and was independently discovered by Frege, Schönfinkel and Curry in the early 20th century.
Example of manual currying (es6)
Uncurried form
/* definition */
let add = (a, b) => a + b;
/* full application */
let x = add(2, 4);
/* partial application */
let add2 = add.bind(null, 2);
let y = add2(4);
Curried form
/* definition */
let add = a => b => a + b;
/* full application */
let x = add(2)(4);
/* partial application */
let add2 = add(2);
let y = add2(4);