Skip to content

Instantly share code, notes, and snippets.

@bholt
Last active August 29, 2015 14:04
Show Gist options
  • Save bholt/6e92c30eee14a32bb26d to your computer and use it in GitHub Desktop.
Save bholt/6e92c30eee14a32bb26d to your computer and use it in GitHub Desktop.
Word Count Example
forall(words, n, [=](string w) {
// hash partitioning
size_t idx = hash(w) % ncells;
delegate(cells+idx, [=](Cell& cell)
{ // runs atomically
if (cell.count(w) == 0) cell[w] = 1;
else cell[r] += 1;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment