Created
January 5, 2018 13:44
-
-
Save anonymous/0b9c7dbe5f0bbb6a88041f5e77a9f09b to your computer and use it in GitHub Desktop.
clojure `->`-style functional chaining
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
"functional chaining, inspired by https://stackoverflow.com/a/17122666/333294" | |
def chain(initial, func_list): | |
caller = lambda x, y: y(x) | |
return reduce(caller, func_list, initial) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment