-
-
Save rightfold/122622e7bb4be37d1a9e to your computer and use it in GitHub Desktop.
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
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