Functional Programming Principles in Scala, assignment 1