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

In my experience, currying is usually helpful as a hack and is tolerable as long as you don't get carried away. One "curry" is fine. Two+ is really pushing it and is probably a signal that something should be refactored.

A lot of people here asking "why". Only solid example of it being the more elegant solution (in my opinion) is on the front end with redux.

Maybe you have a large amount of objects in state. Each object has many properties and is used by many components. If you are using an implementation pattern that predefines selectors, you don't want tons of different functions selecting one property each. The simpler way is a single selector that "picks" the property dynamically by currying the property name to the single, more general selector.




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

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

Search: