      (map (fn [bolt-and-comps]
             (apply unify
                    (let [bolt (get bolt-and-comps [])
-                         bolt-and-comps (dissoc bolt-and-comps [])]
+                         paths-and-comps (dissoc bolt-and-comps [])
+                         paths (keys paths-and-comps)]
                      (cons bolt
-                           (->> (keys bolt-and-comps)
-                                (map (fn [path]
-                                       (let [result (assoc-in bolt path (get bolt-and-comps path))]
-                                         (if (= true truncate)
-                                           (dissoc-paths result [path])
-                                           result))))))))))
+                           (map (fn [path]
+                                  (let [result (assoc-in bolt path (get paths-and-comps path))]
+                                    (if (= true truncate)
+                                      (dissoc-paths result [path])
+                                      result)))
+                                paths))))))
      (map (fn [expression]
             (do-defaults expression model)))
      (filter not-fail?)

    (->>
     (lightning-bolts model spec depth max-depth)
     (filter not-fail?)
     (map (fn [bolt] ;; create a map of paths within the bolt to possible complements in the bolt.
            (assoc
             (comp-paths-to-complements bolt (find-comp-paths bolt) model depth max-depth)
             [] [bolt])))
     (mapcat (fn [each-bolt-and-comps]
               (map (fn [each-path-through-trellis]
                      (zipmap (keys each-bolt-and-comps)
                              each-path-through-trellis))

                                        
;; during generation, will not decend deeper than this when creating a tree:
;; TODO: should also be possible to override per-language.
(def ^:const max-total-depth 8)

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

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

;; nondeterministic generation
;;(def ^:const shufflefn shuffle)

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

(def ^:const truncate true)

