higher order functions in erlang