exercise of Functional Programming Principles in Scala in coursera.org