Solved Scala for the Impatient chapter 2, problems 6, 7, 10.