Exercise 1.21 in Common Lisp