Exercise 1.31 in Emacs Lisp