              (dag_unify.core/strip-refs (dissoc-paths % [[:head][:comp]]))
              %))
 
-     ;; 11. Remove fails.
+     ;; 9. Remove fails.
      (remove #(= :fail %))
      )))
 

(def ^:const handle-unify-fail #(log/debug %))
(def ^:const throw-exception-on-unify-fail false)

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

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

(def ^:const randomize-lexemes-before-phrases
;;  false)
;;(def ^:const randomize-lexemes-before-phrases
  true)

;; whether to remove [:head] and [:comp] paths from generated trees after generation:
;; for performance.

  which makes returning true (i.e. lexemes first) increasingly likely
  as depth increases."
  [depth max-total-depth]
  (and (not randomize-lexemes-before-phrases)
       (> max-total-depth 0)
       (let [prob (- 1.0 (/ (- max-total-depth depth)
                            max-total-depth))]
         (log/trace (str "P(c," depth ") = " prob " (c: probability of choosing lexemes rather than phrases given depth " depth ")"))
         (> (* 10 prob) (rand-int 10)))))

(defn not-fail? [arg]
  (not (= :fail arg)))
