Programming Erlang: Software for a Concurrent world.
Exercise 2, chapter 4