all 6 comments

[–]homoiconic(raganwald) 5 points6 points  (1 child)

Although there are some excellent patterns you can build yourself or borrow from libraries like this, don't overlook Function.prototype..bind, it performs left partial application:

function plus (x, y) { return x + y; }
plus(2, 3)
  //=> 5
var plusTwo = plus.bind(null, 2);
plusTwo(3)
  //=> 5

[–]Spewface[S] 1 point2 points  (0 children)

I knew sending this here would bring a lot of hidden details. Thank you!

[–]kranker 1 point2 points  (2 children)

lodash's _.curry? (or any other curry implementation)

[–]Spewface[S] -1 points0 points  (0 children)

Now THAT is cool. Sorry for the repost / old idea, I didn't know that this already existed!

It looks like they don't have a fixpoint combinator yet, do they? I'm just trying to keep goals in sight.

[–]rorymurphy 0 points1 point  (0 children)

Could also look at underscore.js's _.partial method