Exercises from the book functional programming in scala