This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-23
Channels
- # announcements (2)
- # atom-editor (3)
- # babashka (49)
- # beginners (100)
- # biff (9)
- # calva (78)
- # clj-kondo (18)
- # clojure (143)
- # clojure-europe (13)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-spec (5)
- # clojure-sweden (2)
- # clojure-uk (4)
- # clojurescript (58)
- # conjure (1)
- # cursive (4)
- # datascript (11)
- # datomic (63)
- # docker (7)
- # emacs (18)
- # events (1)
- # fulcro (18)
- # graalvm (5)
- # helix (4)
- # improve-getting-started (13)
- # jobs (4)
- # jobs-discuss (3)
- # lsp (15)
- # malli (90)
- # membrane (14)
- # off-topic (12)
- # other-languages (5)
- # pedestal (7)
- # polylith (53)
- # re-frame (15)
- # reitit (23)
- # releases (4)
- # remote-jobs (9)
- # ring (11)
- # shadow-cljs (90)
- # specter (2)
- # testing (3)
- # tools-build (63)
- # vim (2)
- # xtdb (8)
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