Code written while reading "Scala For Impatient"