lib/ext-underscore.js
function curry(fn, obj) {
  // create a local copy of the function. don't apply anything yet
  // optionally bind an object to the `this` of the function.
  var newFunction = _.bind(fn, (obj || null));

  // curried functions always take one argument
  return function () {
    // create another copy of the function with the arguments applied
    var me = _.partial(newFunction, arguments);

    // take advantage of the fact that bind changes the method signature:
    // if we have no arguments left, run the method
    if (!me.length) return me();

    // otherwise, curry again and return that.
    return curry(me);
  };
}
function curry(fn, obj) {
  // create a local copy of the function. don't apply anything yet
  // optionally bind an object to the `this` of the function.
  var newFunction = _.bind(fn, (obj || null));

  // curried functions always take one argument
  return function () {
    // create another copy of the function with the arguments applied
    var me = _.partial(newFunction, arguments);

    // take advantage of the fact that bind changes the method signature:
    // if we have no arguments left, run the method
    if (!me.length) return me();

    // otherwise, curry again and return that.
    return curry(me);
  };
}
function curry ( fn , obj ) { // create a local copy of the function. don't apply anything yet // optionally bind an object to the `this` of the function. var newFunction = _ . bind ( fn , ( obj || null ) ) ; // curried functions always take one argument return function ( ) { // create another copy of the function with the arguments applied var me = _ . partial ( newFunction , arguments ) ; // take advantage of the fact that bind changes the method signature: // if we have no arguments left, run the method if ( ! me . length ) return me ( ) ; // otherwise, curry again and return that. return curry ( me ) ; } ; }
this takes advantage of ES5 bind's awesome ability to do partial application
this takes advantage of ES5 bind s awesome ability to do partial application