Assignment to functional programming in Scala