Last active
November 7, 2015 21:07
-
-
Save dtipson/6d156f1721a6d508f476 to your computer and use it in GitHub Desktop.
Partially applied reduce.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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