Exercise 1.31 in Clojure