Skip to content

Instantly share code, notes, and snippets.

@Lucretiel
Created April 26, 2013 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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