Every `curry` implementation I’ve met is broken in some way.

Let’s think what `curry` function should do. First: is should implement valid currying. Second: it should keep function name untouched. Third: it should keep function length. Fourth: it should allow to bind `this` after any number of arguments (until last).

Missed name? Expect bugs. Missed length. Expect bugs. Etc.

Not a rocket science, right? Then why every existing curry implementation is broken?





let sum3 = curry((x, y, z) => {
if (this) {
return [x + y + z, this];
} else {
return x + y + z;
// Cannot assign to read only property ‘name’ of function


— — — — — — — — — — — — — — — — — — —

Working one?


Go, check it out yourself.

Written by

Software engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store