Exercises from Functional Programming in Scala book