Currying
In this lesson, we'll learn what currying is.
We'll cover the following
The Definition
Currying is the process of dividing a function with multiple parameters into separate functions for each parameter.
A function can be curried when we provide it with fewer arguments than it originally needs and assign this incomplete call to a new let
binding.
Now, we only need to pass the remaining arguments to the new function.
Note: Passing more arguments than the function actually has, will produce a compile-time error. Currying only works when we provide an incomplete number of arguments.
Example
Let’s make things clearer with the help of an example.
Get hands-on with 1400+ tech skills courses.