       [datascript.core  Datom]
       [datascript.btset Iter])))
 
-(declare resolve-clauses collect)
+(declare resolve-clauses collect-to)
 
 (def ^:const lru-cache-size 100)
 

        (let [non-consts (set/difference syms (set (keys (:consts context))))]
          (if (empty? non-consts)
            context ;; join was by constants only, nothing changes
            (let [sets (map #(collect % non-consts) contexts)
                  rel  (coll-rel non-consts (into (first sets) cat (next sets)))]
              (hash-join-rel context rel))))))
    "resolve-or" (dp/source clause)))


                      (fn [set tuple]
                        (conj! set (getter tuple))))
               (persistent!)))))
    (collect-to context syms (fast-set) [(map vec)])))


(defn subtract-from-rel [rel syms exclude-key-set]
