     (cons (vec (concat (take (- depth 1) (repeatedly (fn [] :head))) [:comp]))
           (find-comp-paths-in (- depth 1)))))
 
-(defn candidate-parents [rules spec]
+(defn candidate-parents
   "find subset of _rules_ for which each member unifies successfully with _spec_"
+  [rules spec]
   (log/trace (str "candidate-parents: spec: " (strip-refs spec)))
   (filter #(not (= :fail %))
           (pmap (fn [rule]

       (lightning-bolts language-model spec 0 total-depth :max-total-depth max-total-depth)
       (add-all-comps language-model total-depth false max-total-depth)))))

(defn lightning-bolts [language-model spec depth total-depth
                       & {:keys [max-total-depth]
                          :or {max-total-depth max-total-depth}}]
  "Returns a lazy-sequence of all possible bolts given a spec, where a bolt is a tree
such that only the head children are generated. This sequence is used by (generate (above))
to generate expressions by adding complements using (add-all-comps)."
  (let [grammar (:grammar language-model)
        depth (if depth depth 0)
        ;; this is the relative depth; that is, the depth from the top of the current lightning bolt.


;; FIXME: truncate-children=false (the non-default option) is not propagated through all calls,
;; causing trees to be unexpectedly truncated.
(defn generate
  "Returns a single expression generated by the given language model, constrained by the given spec."
  [spec language-model
   & {:keys [max-total-depth truncate-children lexicon]
      :or {max-total-depth max-total-depth
           lexicon nil
           truncate-children true}}]
  (let [lexicon (if lexicon lexicon (:lexicon language-model))
        morph (:morph language-model)
        morph-ps (:morph-ps language-model)]
