simulating portions of the sparrow algorithm in clojure