working through the book Functional Programming in Scala