Functional Programming in scala assignments