November 2017
Intermediate to advanced
670 pages
17h 35m
English
We're going to create two functions, Humanize and Emphasize (representing f and g), and a composition function of Emphasize(Humanize(true)) to illustrate the path A to B to C:

The src/compose/compose.go file contains the following code:
package composefunc Humanize(b bool) string { if b { return "yes" } else { return "no" }}func Emphasize(s string) string { return s + "!!"}func EmphasizeHumanize(b bool) string { return Emphasize(Humanize(b))}
main.go looks like this:
package mainimport ( "fmt" . "compose")func main() { fmt.Println("A to B - Humanize(true):", Humanize(true)) fmt.Println("B to C - Emphasize(\"yes\"):" ...
Read now
Unlock full access