> If you want functions with fixed arguments, you could also just create a new function that calls the other with a fixed first argument and just takes the other arguments.
From searching for practical applications a while back, I understood currying as a way to create a new function with fixed values rather than fixed arguments. Meaning if you had a function take arguments FIRST and SECOND, with FIRST being computationally expensive, currying would allow you to create a new function with the slower part pre-calculated.
But after brief testing I’m unsure that’s the case. It seems the examples might’ve been referring to the argument itself being a computationally expensive operation, in which case—and going back to your example—you could save the computation’s result to a variable beforehand and use that.
From searching for practical applications a while back, I understood currying as a way to create a new function with fixed values rather than fixed arguments. Meaning if you had a function take arguments FIRST and SECOND, with FIRST being computationally expensive, currying would allow you to create a new function with the slower part pre-calculated.
But after brief testing I’m unsure that’s the case. It seems the examples might’ve been referring to the argument itself being a computationally expensive operation, in which case—and going back to your example—you could save the computation’s result to a variable beforehand and use that.