example 7: higher order functions