Hacker News new | past | comments | ask | show | jobs | submit login

> 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.




Currying should not create a function with anything fixed that hadn't been fixed before.


I believe you may be mixing the concept of currying with partial application.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: