functional programming principles in scala excercises