fp in scala exercises for chapter 2