This is a continuation in the series around functional programming concepts.
As much as it sounds like a trip to London’s Brick Lane (curry capital of the western world?)… this is not about vindaloo!
Currying is essentially when you break down a function taking multiple arguments into a series of functions. Each of these then taking 1 or more of the arguments.
Consider the following function for adding two values.
You would turn this into a currying function as follows.
The value is in being able to provide the first value.. store the function holding it and it’s subsequent behavior.. and then call it later with the remaining values.
There is some potential danger in readability and could be confusion with what the state of the existing values are. But there it is.