Currying and Function Binding

What is Currying?

Currying is a process of binding some arguments to a function so that those arguments are fixed by the next invocation. i.e. Partial Function Application.

Why is currying useful?

Currying can produce ‘factory’ functions. If we want to define some functions that follow similar patterns/blueprints, we could use currying to mass produce such functions, each with slightly different purpose.

Here, player is a curried function that can mass produce functions with slight variations. This may not be a very useful example. Some better applications might be making a unit converter or currency converter.

Sometimes, people write currying utility helper to transform a normal function into a curried function. Guess what, a basic implementation of a currying helper looks pretty much the same as the Function.prototype.bind function! We could use .bind() to create the curried version (factory) of the function we want!

Some great answers in this StackOverflow link. This post was written after reading extra information from Kristina and Cyrilf.