I re-implementation of gaigen in clojure