Skip to content

Instantly share code, notes, and snippets.

@Prodge
Created February 17, 2017 01:59
Show Gist options
  • Save Prodge/c4cc87cfad88c12987e371d97abb4492 to your computer and use it in GitHub Desktop.
Save Prodge/c4cc87cfad88c12987e371d97abb4492 to your computer and use it in GitHub Desktop.
Filter implementation using reduce in python
def my_filter(fn, coll):
reduce(lambda out, x: out + ([x] if fn(x) else []), coll, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment