erlang: add an each fun to fold items