 (declare comp-path-to-bolts)
 (declare create-mapping)
 
-(defn bolts-with-comps
-  "return a lazy sequence of maps. Each member in this lazy sequence associates a lightning bolt with the complements of that bolt. The sequence member is a map of paths within the bolt to to the lazy sequence of possible complements at the end of each such path. In addition, there is an key [] whose value is the bolt itself."
-  [spec model depth max-depth]
-  (map (fn [lb]
-         (merge
-          (let [comp-paths (find-comp-paths lb)]
-            (zipmap comp-paths
-                    (map (fn [path]
-                           (filter not-fail? (comp-path-to-bolts lb path model depth max-depth)))
-                         comp-paths)))
-          {[]
-           (filter not-fail? [lb])}))
-       (lightning-bolts model spec depth max-depth)))
-
 (declare nugents)
 
 ;;(def foo (map #(println (fo %)) (take 10000 (nugents med spec))))
 
-(defn comp-path-to-bolts
-  "return a lazy sequence of bolts for all possible complements that can be added to the end of the _path_ within _bolt_."
-  [bolt path model depth max-depth]
-  (let [spec (get-in bolt path)
-        lexemes (shufflefn (get-lexemes model spec))
-        bolts-at (if (< depth max-depth)
-                   ((if true
-                      nugents ;; nugents is slow
-                      lightning-bolts) ;; lightning-bolts is fast
-                    model
-                    (get-in bolt path)
-                    depth max-depth))
-        lexemes-before-phrases
-        (lexemes-before-phrases depth max-depth)]
-    (if lexemes-before-phrases
-      (lazy-cat lexemes bolts-at)
-      (lazy-cat bolts-at lexemes))))
-
 (declare add-bolt-at)
 
+;; TODO: use recur or reduce
 (defn do-assocs [accum paths val-at-paths model]
   (if (empty? paths)
     accum


(defn filter-by [bolt-and-comps]
  (not (some empty? (vals bolt-and-comps))))

(defn nugents [model spec & [max-depth]]
  (log/debug (str "nugents:" (strip-refs spec)))

                     (first paths)
                     (first val-at-paths))]
       (if (not (empty? (first paths)))
         (dissoc-paths result [(first paths)] model)
         result))
     (rest paths)
     (rest val-at-paths)
