loading...

Discussion on: What the heck is Currying anyway?

Collapse
devdufutur profile image
Rudy Nappée

Great explanation on a not so easy concept.

However you should always put the "point" (argument on which the partial application operates in the end) in the last position :

const isType = type => obj => obj.type === type;

This way you don't need to redefine functions, just :

const isFruit = isType("Fruit");
const isVegetable = isType("Vegetable");

Or write in a straightforward way :

const fruits = items.filter(isType('fruit'));
const vegetables = items.filter(isType('Vegetable'));
Collapse
heytulsiprasad profile image
Tulsi Prasad Author

Thanks for the great tip! I'll add this to the blog soon! 🤗

Collapse
heytulsiprasad profile image
Tulsi Prasad Author

Finally got some time to update the post with this. Thanks again, for sharing!