Functional programming principles and SCALA