                     (string/join "," (map :rule result))
                     " for: " (spec-info spec))))
     result))
-
-(defn log-unification-result [a b result model]
-  (when (and (not (= :fail a)) (not (= :fail b)))
-    (if (= :fail result)
-      (do
-        ;; warn because fails are expensive and should be filtered out before hitting this.
-        (log/warn (str "failed to unify("))
-        (log/warn (str "  a: " ((:morph-ps model) a) ","))
-        (log/warn (str "  b: " ((:morph-ps model) b)))
-        (log/debug (str "  ser a: (def a (dag_unify.core/deserialize '(" (string/join "" (:dag_unify.core/serialized a)) ")))"))
-        (log/debug (str "  ser b: (def b (dag_unify.core/deserialize '(" (string/join "" (:dag_unify.core/serialized b)) ")))"))
-        (log/warn (str ") => fail@" (fail-path a b)))
-        (let [message (str "failed to unify:( "
-                           "  a: " ((:morph-ps model) a) ","
-                           "  b: " ((:morph-ps model) b)
-                           "  morph a: " ((:morph model) a) ","
-                           "  b: " (keys b)
-                           ") => fail@" (fail-path a b))]
-          (if exception-on-unify-fail (throw (Exception. message))
-              (log/warn message))))
-            
-      (log/debug (str "unify(" ((:morph-ps model) a)
-                      " , " ((:morph-ps model) b) ") => "
-                      ((:morph-ps model) result))))))
-

;; use map or pmap.
(def ^:const mapfn map)

(def ^:const exception-on-unify-fail
  false)

;; deterministic generation:
;;(def ^:const shufflefn (fn [x] x))


(defn unify-and-log [a b model]
  (let [result (unify a b)]
    (when (and (not (= :fail a)) (not (= :fail b)))
      (if (= :fail result)
        (let [message (str "failed to unify:( "
                           "  a: " ((:morph-ps model) a) ","
                           "  b: " ((:morph-ps model) b)
                           "  morph a: " ((:morph model) a) ","
                           "  b: " (keys b)
                           ") => fail@" (fail-path a b))]
          (handle-unify-fail message)
          (if (= true throw-exception-on-unify-fail)
            (throw (Exception. message))))
        
        (log/debug (str "unify(" ((:morph-ps model) a)
                        " , " ((:morph-ps model) b) ") => "
                        ((:morph-ps model) result)))))
    result))

(defn comp-path-to-complements
