Fork me on GitHub

I have a recursive-path walker in the works, but I am hitting a not on a particular prismatic/shema record. In particular, s/if returns a record with two paths I would like to explore (say, left and right). I know how to extract them from the record but not how to navigate to both of them:

(def ^:private PATH-SCHEMA-WALKER
  (recursive-path [] p
                    (fn [v]
                      (instance? schema.core.ConditionalSchema v))
                    [ALL (collect-one FIRST) LAST p] ;; how do I walk left and right here?

                    (fn [v]
                        (primitive-schema? v) false
                        (map? v) true ;; this is a real path
                        :default false))
                    [ALL (collect-one FIRST) LAST p]

                    (fn [v] true) STAY)))
Here is my attempt above, but I don't know what to put for the first path. Here is how I can extract the schemas:
(if (instance? schema.core.ConditionalSchema x)
    (let [[p+s1 s2] (:preds-and-schemas (s/if map?
                                          {:first :schema} {:second :schema})
      {:s1 (second p+s1) :s2 s2})


@nha to walk multiple paths the general answer is to use multi-path, e.g. (multi-path :left :right)


Will try, thanks simple_smile


@nha btw instead of (fn [v] true) for default case you can just write STAY