completed problem 8 in clojure