A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
11
Task/Function-composition/Go/function-composition-1.go
Normal file
11
Task/Function-composition/Go/function-composition-1.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Go doesn't have generics, but sometimes a type definition helps
|
||||
// readability and maintainability. This example is written to
|
||||
// the following function type, which uses float64.
|
||||
type ffType func(float64) float64
|
||||
|
||||
// compose function requested by task
|
||||
func compose(f, g ffType) ffType {
|
||||
return func(x float64) float64 {
|
||||
return f(g(x))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue