     (cons (vec (concat (butlast path) [:comp]))
           (find-comp-paths-in bolt (concat path [:head])))))
 
+(defn bolt-depth [bolt]
+  (if-let [head (get-in bolt [:head] nil)]
+    (+ 1 (bolt-depth head))
+    0))
+
+(defn find-comp-paths-in [depth]
+  (cond
+    ;; most-frequent cases done statically:
+    (= 0 depth) nil
+    (= 1 depth) [[:comp]]
+    (= 2 depth) [[:head :comp][:comp]]
+    (= 3 depth) [[:head :head :comp][:head :comp][:comp]]
+    (= 4 depth) [[:head :head :head :comp][:head :head :comp][:head :comp][:comp]]
+
+    ;; 
+    true
+    (cons (vec (concat (take (- depth 1) (repeatedly (fn [] :head))) [:comp]))
+          (find-comp-paths-in (- depth 1)))))
+
 (defn add-complement-to-bolt [bolt path language-model total-depth
                               & {:keys [max-total-depth truncate-children]
                                  :or {max-total-depth max-total-depth
                                       truncate-children true}}]
-  (log/debug (str "add-complement-to-bolt: " (show-bolt bolt path language-model)
+  (log/debug (str "add-complement-to-bolt: " (show-bolt bolt language-model)
                   "@[" (string/join " " path) "]" "^" total-depth))
   (let [index (:index language-model)
         lexicon (if (-> :generate :lexicon language-model)

                         (truncate unified [path])
                         unified)))
                  (let [debug (log/trace (str "add-complement-to-bolt(total-depth=" total-depth
                                              ",path=" path ",bolt=(" (show-bolt bolt path language-model)
                                              "): calling generate-all(" (strip-refs spec) ");"
                                              "spec: " spec))
                        phrasal-complements (if (and (> max-total-depth total-depth)

(declare candidate-parents)
(declare lazy-shuffle)
(declare find-comp-paths-in)
(declare bolt-depth)
(declare add-all-comps)
(declare add-all-comps-with-paths)

