While having a read in to the art of function programming, I stumbled upon a curious technicality. Those that know me know (perhaps wearily) I love talking about technical stuff.
Currying (wikipedia) builds a single function that, in effect, takes multiple arguments by composing a chain of functions that each take a single argument and eventually yield the final result:
f: (x, y, z) -> result
curry(f): x -> (y -> (z -> result))
So if you wanted to call a curried function, it would look something like:
f(first_arg)(second_arg)(third_arg)
Functional languages often compose multiple-argument functions using what appears to be currying.
But wait, that’s not what I just said! I must be an awful writer, spreading misinformation like that. After all, I’ve read plenty of blogs and articles that tell me that currying is where you “fix” some arguments in place ahead of final invocation. The result is creating a function with fewer arguments, like so:
f(x, y, z) -> result
g(z) -> f(1, 2, z)
It turns out that this is known as partial function application. How it came to be known as currying I am not sure, but it seems to be a very common misconception. I believed it too until recently! Yet another thing to remember.
Wikipedia contrasts currying and partial function application in detail if you want to compare them further.