                           (fn [spec]
                             (flatten (vals
                                       (or (:lexicon (:generate model))
-                                          (:lexicon model)))))))]
+                                          (:lexicon model)))))))
+             morph-ps (:morph-ps model)]
      (first (gen spec)))))
 
 (defn gen

(def ^:const branch? #(let [result (= 0 (rand-int (+ % branching-factor)))]
                        (log/debug (str "branch at: " % "? => " result))
                        result))
(def ^:dynamic truncate? false)
(def ^:dynamic println? false)
(def ^:dynamic default-fn (fn [x] [x]))
(def ^:dynamic model)
(def ^:dynamic morph-ps)
(def ^:dynamic index-fn)
(def ^:dynamic grammar)

(declare assoc-children)
(declare frontier)

(defn generate
  "Return one expression matching spec _spec_ given the model _model_."
  ([spec]
   (first (gen spec)))

  ([spec model]
   (log/debug (str "(generate) with model named: " (:name model)
                   "; truncate? " truncate?))
   (binding [default-fn (if (:default-fn model)
                          (:default-fn model)
                          (fn [x] [x]))
             grammar (:grammar model)
             index-fn (if (:index-fn model)
                        (:index-fn model)
                        (do
