In my last post I’ve tried to explain the differences between partial function application and function currying.
But as I remarked on, the post wasn’t academically correct, more precisely the examples I’ve used had a specific purpose of
. Skipping that part for now, let’s just see what exactly currying means to its true definition.
In mathematics and computer science, currying is the technique of transforming a function that takes multiple arguments (or an n-tuple of arguments) in such a way that it can be called as a chain of one argument functions.
If we where true to that definition, a function
Now, for a second let’s suppose that we could actually curry a function to that form. As far as I was able to reason and do, the only possible variant was a curry function with
Anyway let’s see that
curry function in action:
While an interesting hack, it’s far away from being a
curry function. In fact, there is no single
In the voice of a great man,
Currying definition: http://en.wikipedia.org/wiki/Currying
Prototype function curry documentation: http://api.prototypejs.org/language/Function/prototype/curry/
Underscore function bind documentation: http://documentcloud.github.com/underscore/#bind