               (right-sib-zips d))
     []))
 
-
-
 (defn set-zip-children
   [z c]
   (z/edit z #(z/make-node z

                      <>))
           [])
   :set (if tags
          (-> summary
              :set
              (or #{})
              (conj tags))
          #{})})

(defn merge-children-tag-summary

      (let [zn (z/next z)]
        (if-not (z/end? zn)
          (recur (tag* zn pred-map))
          ;; reset zipper
          (z/edit zipr (-> z z/root constantly)))))))

(defn pred-query
  [zipr pred]
  (let [z' (set-zip-children zipr
                             (->> zipr
                                  children-zips
                                  (mapcat #(pred-query %
                                                       pred))
                                  vec))
        n (z/node z')]
    (if (-> n
            meta
            ::?
            pred)
      [n] ;; clear meta ::?
      (z/children z'))))

(defn query
  [zipr pred-map pred-final]
  (-> zipr
      (tag pred-map)
      (pred-query pred-final)))

#_ (do
     (def z2 (tag z1
                  {:a #(-> % :id #{1 2 3 4}) :even #(-<> (do %)
                                                         :id
                                                         even?)}))

     (ppcp tree2)
     (println)
     (-> tree2
