                         {}))))
        (reduce (partial merge-with into) {})))
 
-(def time-diff-memo
-  (memoize
-    (fn [bef aft]
-      ((fn [[b a]] [(set/difference b a) a])
-       (->> (data/diff bef aft) (take 2) (map (comp set keys)))))))
-
 (defn time-diff [before after]
-  (time-diff-memo (:time before) (:time after)))
+  ((fn [[b a]] [(set/difference b a) a])
+   (->> (data/diff (:time before) (:time after)) (take 2) (map (comp set keys)))))
 
 (defmulti  patch-cp? (fn [pred a b] pred))
 (defmethod patch-cp? :default [_ a b] true)

(defn watcher! [pred & dirs]
  (let [state (atom nil)]
    (fn []
      (let [state' (apply files-for dirs)
            patch' (patch pred @state state')]
        (reset! state state')
        patch'))))

        [:cp x a]))))

(defn sync! [pred dest & srcs]
  (let [before (tree-for dest)
        after  (apply tree-for srcs)]
    (doseq [[op p x] (patch pred before after)]
      (case op
        :rm (io/delete-file x true)
