Created
March 10, 2015 20:19
-
-
Save ceeblet/b8d99f6614409ab4792e to your computer and use it in GitHub Desktop.
console session demonstrating function composition
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
>>> def compose(g, h): | |
... def anon(x): | |
... return g(h(x)) | |
... return anon | |
... | |
>>> f3 = compose(f1, f2) | |
>>> f3("Shillalegh") | |
<__main__.Func object at 0x100569dd0>('Shillalegh') called | |
f1('Shillalegh') called | |
'Shillalegh' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
f1 and f2 were previously defined