Currying and Partial Application


Situations that require passing arguments to a function one by one, often in disjoint phases of task processing, warrant the use of function decomposition through currying. The approach is suitable for scenarios where we don’t have access to all function arguments at the same time.

Currying by default

A function can either be curried by default, a higher-order function that returns a function with an arity of one, or curried using a helper function. The code snippet below shows a naturally-curried function:

Get hands-on with 1200+ tech skills courses.