Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't think "curry" is quite the right name for that function. For a function

    int f(int, int, int);
the curried version of f,

    auto f_curried = curry(f);
must be able to take multiple arguments one-at-a-time, so

    f_curried(x)(y)(z) == f(x, y, z)
The code at https://dpaste.de/a8g9D/ just partially applies the function to one set of arguments, which isn't enough -- you have to keep partially applying until you get them all.


I knew I should have just called it bind.

As a bonus, an actual implementation of curry: https://dpaste.de/qGWcq/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: