an erlang exercise