Skip to content

Instantly share code, notes, and snippets.

@rightfold
Created April 27, 2015 09:02
Show Gist options
  • Save rightfold/122622e7bb4be37d1a9e to your computer and use it in GitHub Desktop.
Save rightfold/122622e7bb4be37d1a9e to your computer and use it in GitHub Desktop.
aggregate("sum", 0, function(a, b)
return a + b
end)
-- gather yields records
function gather(argv, yield)
for i = 1, 100 do
yield(i)
end
end
-- process is called in parallel for each record yielded by gather
function process(record)
sum(record)
end
-- summarize is called when gather returns and all records have been processed
function summarize()
log(sum())
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment