Code example from Joe Armstrong's 'Programming Erlang, 2nd Edition'