 (defn generate
   "Return one (by default) or _n_ (using :take _n_) expressions matching spec _spec_ given the model _model_."
   [spec language-model
-   & {:keys [max-total-depth truncate-children lexicon take]
+   & {:keys [max-total-depth truncate-children lexicon take-n]
       :or {max-total-depth max-total-depth
            lexicon nil
            truncate-children true
-           take 1}}]
-  (log/debug (str "generate: spec: " spec "; take: " take))
+           take-n 1}}]
+  (log/debug (str "generate: spec: " spec "; take-n: " take-n))
   (let [depth 0
         spec
         (->

         (dissoc :dag_unify.core/serialized))
        max-depth max-total-depth]
    (->
     (clojure.core/take
      take
      (reduce concat
              (map #(do
                      (log/trace (str "add-bolt-at:" ((:morph-ps language-model) %)))
                      (let [result (filter (fn [x] (not (= :fail x)))
                                           (add-bolt-at % % [] % language-model depth max-depth truncate-children take))]
                        result))
                   (lightning-bolts language-model spec 0 max-total-depth))))
     ((fn [seq]
        (if (= take 1)
          (first seq) ;; if caller only wants one, return just that one, rather than a singleton list.
          seq)))))) ;; otherwise, return the lazy seq of expressions


             bolt top-bolt model depth max-depth truncate? take-n)))))

(defn add-bolt-at [top-bolt bolt path bolt-at model depth max-depth truncate? & [take-n]]
  "at _path_ within _bolt_, add all complements derived from _bolt-at_"
  (mapfn #(do-defaults % model)
         (let [comp-paths (find-comp-paths bolt-at)]
           (mapfn #(assoc-in bolt path %)
