Functional programming in Groovy