currying
sergiivorobei opened this issue · 1 comments
sergiivorobei commented
Hello guys! Really enjoy what you are doing.
In Haskell every function is curried. Probably you should transform existing functions to support currying? (And in es6 it looks nice))
My implementation is:
function curry(fn, ...initialArgs) {
const curried = (...args) => {
if (args.length >= fn.length) {
return fn(...args);
}
return (...moreArgs) => curried(...[...args, ...moreArgs]);
}
return curried(...initialArgs);
};
veggiemonk commented
@kennyx46 looks really neat!! I think I am going to reuse your code... Thanks a lot 😄