Skip to content

Instantly share code, notes, and snippets.

@joshski
Created January 7, 2013 08:27
Show Gist options
  • Save joshski/4473323 to your computer and use it in GitHub Desktop.
Save joshski/4473323 to your computer and use it in GitHub Desktop.
concatenative pogo
async = require 'async'
one ! = 1
two ! = 2
plus ! (x, y) = x + y
log ! (x) = console.log (x)
concat (memo, item, callback) =
done = @(err, result)
callback (err, memo.concat(result))
args = []
for (i = 0, i < item.length - 1, ++i)
args.push(memo.pop())
item.apply (this, args.concat(done))
async.reduce ([one, two, plus, log], [], concat) @{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment