Created
February 7, 2012 06:16
-
-
Save bohde/1757619 to your computer and use it in GitHub Desktop.
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
| from itertools import takewhile | |
| def combinator_style(xs): | |
| return Combinators(xs).chain().R( | |
| takewhile, lambda x: x < 7 | |
| ).R( | |
| filter, lambda x: x < 2 | |
| ).R( | |
| map, lambda x: 4 * x | |
| ).value() | |
| assert combinator_style(range(10)) == [0, 4] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment