Created
June 21, 2013 05:06
-
-
Save kmerenkov/5828983 to your computer and use it in GitHub Desktop.
Inspired by clojure/comp
This file contains 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
fs = [lambda x: x*x, lambda y: y+y, lambda z: str(z)] | |
comp = lambda fs, arg: reduce(lambda x, y: y(x), fs, arg) | |
comp(fs, 5) # returns '50', i.e. str((5*5)+(5*5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment