specter

Latest version: 1.1.3
2018-05-04T02:02:50.000033Z

I'm trying to use specter/zipper to create a custom zipper. I have the clojure.zip/zipper working ok, but when I attempt to wrap it using specter/zipper I get this error:

anh-front.tree> (def tz (specter-tree-zip test-tree))
#object[TypeError TypeError: anh_front.tree.specter_tree_zip.call is not a function]
nil
Heres the code, I have clojure.zip required as zip and specter.zip required as sz
(defn tree-zip
  "Returns a zipper for tree elements given a root element"
  [root]
  (zip/zipper (complement string?)
              (fn [node] (if (:expanded node)
                           (seq (:children node))))
              (fn [node children]
                (assoc node :children (and children (apply vector children))))
              root))

(def specter-tree-zip (sz/zipper tree-zip))
Any idea what I have done wrong?

nathanmarz 2018-05-04T02:16:05.000023Z

@soulflyer sz/zipper returns a navigator, not a function

nathanmarz 2018-05-04T02:16:15.000156Z

you use it in a path to navigate to the zipper object

nathanmarz 2018-05-04T02:16:37.000088Z

e.g. (transform [specter-tree-zip sz/DOWN ...

2018-05-04T02:22:25.000084Z

ah, that makes sense. I wrongly assumed I could just drop it in where I had used clojure.zip/zipper Thanks!