Solving exercises from Manning's Functional Programming in Scala