Created
December 12, 2013 07:53
-
-
Save kvoss/7924571 to your computer and use it in GitHub Desktop.
Python: something functional
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 zipWith (f, xs, ys): | |
| lf = lambda (a,b) : f(a,b) | |
| args = zip (xs, ys) | |
| rs = map (lf, args) | |
| return rs | |
| def compose (fs): | |
| def f (x): | |
| for f in fs [::-1]: | |
| x = f (x) | |
| return x | |
| return f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment