functional programming in scala amazon