Functional programming in Scala assignments