Today’s Eponymy in August (Nerd Week) is Currying. This doesn’t have anything to do with Indian food; it does have to do with the intersection of math and programming.
A bit of background: functions are mathematical constructs. They don’t just exist in programming computers. In math, a function is relation between a domain (a set of possible input values) and a range (a set of output values). Each member of a domain must yield one value from the range for a relation to be termed a function (so strictly speaking, square root is a relation but not a function, since is and also ; a function version of this relation might specify only the positive square root as an output value).
A mathematical ideal function has only one parameter. This makes the formalism easier to write and reason about, but is less useful from the practical side. E.g. if we look at a function which performs addition, add(2) isn’t really useful but add(2, 3) is certainly useful.
Currying is a method of resolving these two approaches to specifying functions. A method f(x, y) that takes values x and y in their respective domain classes X and Y (whatever values are allowed), and yields a value g in a class G, can be broken down into a function f(x) that takes x from X and yields a function f'(y); this latter function takes y from Y and yields g in G.
Applying this method to our addition function, we can restructure the two-argument function add(2, 3) as a function add(2) yielding the function add2() — this function adds 2 to its argument. So the second argument is then passed to the generated function: add2(3) then yields 5.
As a formalism, then, we can specify “add” as a formal type: number -> number -> number (where “->” means a function taking what’s to the left of it and yielding what’s to the right), and due to right-associativity rules, that would be the same as a function definition of (number, number) -> number when uncurried, as long as all the parameters were supplied. You might recognize the former type definition if you’ve ever worked with the programming language Haskell, which automatically curries all function definitions to allow for partial application. Both Haskell and Currying are named for Haskell Curry.
Haskell Curry was a mathematician at Penn State through much of the early to mid 20th century. His work in combinatory logic and high level programming languages laid the groundwork for computing (much of it having been done before electronic computers existed) and reverberate to this day.
