I'm not sure, but I think I may have stumbled across a bug in recursive paths (maybe just paths) wrt lazyseqs. Here is a small whittled down example.
(def CM-NODES-2
(sp/recursive-path
[] p
(sp/cond-path
#(and (map? %) (do (prn :MAP %) true)) [sp/ALL p]
#(and (list? %) (do (prn :LIST %) true)) [sp/ALL p]
#(and (vector? %) (do (prn :VECTOR1 %) true)
(= (-> (nth % 0) str) "cm")) (sp/continue-then-stay sp/ALL p)
#(and (vector? %) (do (prn :VECTOR2 %) true)) [sp/ALL p]
#(and (seq? %) (do (prn :SEQ %) true) [sp/ALL p]))))
(let [sq (map identity (range))]
[(type sq) (seq? sq)])
=> [cljs.core/LazySeq true]
;;; On JVM
=> [clojure.lang.LazySeq true]
;;; Same results of following on JVM or JS (cljs)
(defn test-rpath-lazysq [specs]
(sp/select
CM-NODES-2
specs))
(test-rpath-lazysq (map identity '[[one two three] [cm :a 1 :b2 :src ""]]))
=> []
(test-rpath-lazysq (vec (map identity '[[one two three] [cm :a 1 :b2 :src ""]])))
:VECTOR1 [[one two three] [cm :a 1 :b2 :src ""]]
:VECTOR2 [[one two three] [cm :a 1 :b2 :src ""]]
:VECTOR1 [one two three]
:VECTOR2 [one two three]
:VECTOR1 [cm :a 1 :b2 :src ""]
=> [[cm :a 1 :b2 :src ""]]Doesn't look like lazyseq is being dived into. But, could be a cockpit error on my part. Couldn't find anything specific about lazyseqs in paths though