Learning Functional Programming in Go
上QQ阅读APP看书,第一时间看更新

A visual example of functions that modify functions

In the previous example we composed part of an HTML web page. In this example, let's immerse ourselves into a Railroading world and lay down some train tracks using function composition.

Immersive Railroading World

The following is our toolbox of reusable components. We modify our world by adding items from our toolbox. Thus, our immersive railroading world function is modified by adding and connecting a bunch of smaller component functions.

Here's Christian laying down a railroad switch: