Skip to content

Instantly share code, notes, and snippets.

@corani
Created March 30, 2011 05:41
Show Gist options
  • Save corani/893920 to your computer and use it in GitHub Desktop.
Save corani/893920 to your computer and use it in GitHub Desktop.
Reduce
Integer result = 0;
for (Integer value : items) {
result = result + value;
}
from functools import reduce
result = reduce(lambda x, y: x + y, items)
SELECT SUM(value) FROM items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment