Can someone help provide an example of how the call on the last test of the Rosetta Code: Accumulator Factory would look like? I feel like I’m heading into lambda calculus territory of which I’m unfamiliar with.
So I have the basic understanding that double parentheses in a function call works so long as the first part of the function call returns a function. Using the tests from the challenge as an example, accumulator(0)(2)
works because accumulator(0)
returns a function and processes (2)
as the argument of the returned function. This makes sense to me, but this is only for two sets of arguments which in the end returns a number.
What would the code look like if there were more than two sets of arguments such as the last test of the challenge?