Skip to content

Instantly share code, notes, and snippets.

@munk
Created May 19, 2013 16:21
Show Gist options
  • Save munk/5608141 to your computer and use it in GitHub Desktop.
Save munk/5608141 to your computer and use it in GitHub Desktop.
Some tools for a mongo course, written in python using an obfuscated functional style with emacs lambda substitution
from pymongo import Connection as Cn
from itertools import chain as ch
collection = λ D, C: Cn()[D][C]
orphans = λ c, d, j, k: {[i[j] for i in c]} - {ch(*[a[k] for a in d])}
remove = λ d, k, c: map(d[k].remove, c)
verify = λ k, t: filter(λ i: k in i[t], c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment