4 ms·
It is stated that JavaScript doesn't have partial function(al) application. Isn't it available through the built in Function#bind method?
by ville 14y ago
It is stated that JavaScript doesn't have partial function(al) application. Isn't it available through the built in Function#bind method?
- raganwald 14y agoYes, and yet, no. Bind binds this as well as arguments from L2R, so you can't bind arguments while allowing apply or call to set the context. You also can't bind arguments leaving a "hole."
- jrajav 14y agoFunction#bind isn't the greatest solution, since it forces you to set 'this' and only allows left-to-right, flat application. Many people have written partial application libs to make it easier to work with (I even have one of my own on github). A good one is substack's: https://github.com/substack/node-ap https://github.com/substack/node-ap