solutions to http://files.metaprl.org/doc/ocaml-book.pdf