completed solution to problem 7 in clojure