examples based on ch2 of functional programming in scala
chapter 3 examples