Skip to content

Instantly share code, notes, and snippets.

@dtipson
Last active November 7, 2015 21:07
Show Gist options
  • Select an option

  • Save dtipson/6d156f1721a6d508f476 to your computer and use it in GitHub Desktop.

Select an option

Save dtipson/6d156f1721a6d508f476 to your computer and use it in GitHub Desktop.
Partially applied reduce.js
var reduce = function(fn){
return function(Arr, acc){
return Arr.reduce(fn,acc);
}
}
var add = reduce(function(acc, x){
return acc+x;
});
add([1,2,3],0);// -> 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment