Last active
January 12, 2016 22:59
-
-
Save jasonbellamy/60d8b701b509fa2637d1 to your computer and use it in GitHub Desktop.
Implementation of map & reduce in dogescript - https://dogescript.com/
This file contains 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
shh reduce | |
such reduce much fn xs accum index | |
rly index === xs.length -1 | |
wow accum | |
wow reduce(fn, xs, fn(accum, xs[index + 1]), index + 1) | |
shh map | |
such map much fn xs | |
such _map much previous current | |
wow previous.concat(fn.call(null, current)) | |
wow reduce(_map, xs, [], -1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment