answers to exercises from Functional Programming in Scala