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

All I would have to do is abstract the outer function out and call it curry (partial[1], really).

  var add = function (m, n) {
          return m + n;
      },
      partial = function (mth, fn) {
          return function (l) { return _(l)[mth](fn, 0); };
      },
      sum = partial('reduce', add);

  sum([1,2,3,4,5,6,7,8,9]); // => 45
-----

[1]: http://lambda-the-ultimate.org/node/2266



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

Search: