           outs   (map #(srcdir->outdir % src dest) files)]
       (mapv copy-with-lastmod (map io/file files) (map io/file outs)))))
 
-(defn files-for [& dirs]
+(defn tree-for [& dirs]
   (->> (for [dir dirs]
          (let [path  (-> (if (string? dir) dir (.getPath dir)) (.replaceAll "/$" ""))
                snip  (count (str path "/"))]

                        {}))))
       (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)))

(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 tree-for dirs)
            patch' (patch pred @state state')]
        (reset! state state')
        patch'))))
