Created
November 7, 2017 19:14
-
-
Save phcostabh/09039617991d7e70b7839ec54397c33e 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
| type fn func(string) | |
| func compose(fns ...fn) fn { | |
| return func(s string) string { | |
| f := fns[0] | |
| fs := fns[1:] | |
| if len(fns) == 1 { | |
| return f(s) | |
| } | |
| return f(compose(fs...)(s)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment