Principles of Programming Languages class Scala codes