Created
February 17, 2017 01:59
-
-
Save Prodge/c4cc87cfad88c12987e371d97abb4492 to your computer and use it in GitHub Desktop.
Filter implementation using reduce in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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