Skip to content

Instantly share code, notes, and snippets.

@phcostabh
Created November 7, 2017 19:14
Show Gist options
  • Select an option

  • Save phcostabh/09039617991d7e70b7839ec54397c33e to your computer and use it in GitHub Desktop.

Select an option

Save phcostabh/09039617991d7e70b7839ec54397c33e to your computer and use it in GitHub Desktop.
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