Functional Programming in Scala - exercises from the book