Skip to content

Instantly share code, notes, and snippets.

@Lucretiel
Created April 26, 2013 23:56
Show Gist options
  • Save Lucretiel/5471220 to your computer and use it in GitHub Desktop.
Save Lucretiel/5471220 to your computer and use it in GitHub Desktop.
That moment when you thought you were programming in Python but it turns out you were actually programming in Lisp
import sys
from itertools import imap, ifilter
print tuple(reduce(
lambda totals, new: imap(lambda x, y: x+y, totals, new),
imap(
lambda line: imap(int, line.split()[:2]),
ifilter(
lambda line: line.strip(),
sys.stdin))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment