functional programming in scala
3.24 excersise