Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

currying #9

Open
sergiivorobei opened this issue Nov 24, 2015 · 1 comment
Open

currying #9

sergiivorobei opened this issue Nov 24, 2015 · 1 comment

Comments

@sergiivorobei
Copy link

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
Copy link

@kennyx46 looks really neat!! I think I am going to reuse your code... Thanks a lot 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants