This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-21
Channels
- # announcements (4)
- # beginners (47)
- # cider (7)
- # clj-kondo (9)
- # cljs-dev (16)
- # clojure (8)
- # clojure-dev (33)
- # clojure-europe (39)
- # clojure-germany (2)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (18)
- # clojure-uk (6)
- # clojuredesign-podcast (8)
- # clojurescript (12)
- # cursive (9)
- # datomic (24)
- # docker (3)
- # fulcro (23)
- # hoplon (7)
- # hyperfiddle (2)
- # java (5)
- # jvm (3)
- # leiningen (9)
- # lsp (6)
- # off-topic (75)
- # pathom (17)
- # polylith (21)
- # reitit (1)
- # rewrite-clj (11)
- # scittle (2)
- # shadow-cljs (57)
- # uncomplicate (6)
- # yamlscript (27)
is there an equivalent to tree-seq
or the zipper api?
probably not, no, i'm just doing some performance testing and didn't want to dive into using the zipper api if it's too slow for my current needs
Oh zipper API, I thought just the Node stuff. How would a tree-seq on a zipper make sense?
lol it might not! i'm very unfamiliar with it, so i'm just experimenting at the moment.
I think I know what you might be getting at though. There is z/next
to iterate through all the nodes
here's a loop where I'm going through all the nodes with z/next: https://github.com/borkdude/carve/blob/e02b65f9de679450176a3fa26c89ffd5600d7eb8/src/carve/impl.clj#L124-L151
you don't have to build one for me, i don't think i'm going to end up using the zipper api in any real way
I typically reach for zippers when tree-seq
is not enough but you could easily write
(defn zipseq
[z]
(lazy-seq
(cons (z/node z)
(when-let [zn (z/next z)]
(zipseq zn)))))
This kind of defeats the purpose of zippers, you can build such a tree-seq entirely without zippers too
lol my goal was to test how much time it takes to traverse the different representations of a file of clojure code