Exercise 1.29 in Emacs Lisp