 
 (defn- matching-dep? [dmap store deps]
   (some (fn [[vstore vdeps]]
+          #_(.log js/console "Matching: "
+                (= store vstore)
+                (pr-str deps)
+                (pr-str vdeps)
+                (match-deps vdeps deps)
+                (and (= store vstore)
+                     (or (nil? deps) (nil? vdeps)
+                         (match-deps vdeps deps))))
           (and (= store vstore)
                (or (nil? deps) (nil? vdeps)
                    (match-deps vdeps deps))))

  (invalidate! [this store deps]
    (let [[c invalidated]
          (reduce (fn [[c i] [params [value dmap]]]
                    (if (matching-dep? dmap store deps)
                      [(dissoc! c params) (conj i params)]
                      [c i]))
                  [(transient cache) []]
                  cache)]
      (set! cache (persistent! c))
      (set invalidated)))
  (reset! [this] (set! cache {}) this))

(defn default-cache []

(deftype DefaultTracker [^:mutable dmap]
  IDependencyTracker
  (depends! [this store new-deps]
    #_(.log js/console "depends!: " dmap (pr-str new-deps))
    (set! dmap (update-in dmap [store] (fnil merge-deps (empty-deps store)) new-deps))
    #_(.log js/console "   " dmap)
    this)

  (dependencies [this] dmap))

