Coursera Scala Recture homework