Skip to content

Instantly share code, notes, and snippets.

@jasonbellamy
Last active January 12, 2016 22:59
Show Gist options
  • Save jasonbellamy/60d8b701b509fa2637d1 to your computer and use it in GitHub Desktop.
Save jasonbellamy/60d8b701b509fa2637d1 to your computer and use it in GitHub Desktop.
Implementation of map & reduce in dogescript - https://dogescript.com/
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