This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-13
Channels
- # announcements (8)
- # architecture (11)
- # babashka (159)
- # beginners (112)
- # biff (4)
- # chlorine-clover (4)
- # cider (10)
- # clj-kondo (51)
- # cljs-dev (43)
- # cljsrn (10)
- # clojure (45)
- # clojure-bay-area (5)
- # clojure-europe (11)
- # clojure-france (4)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-norway (1)
- # clojure-sweden (1)
- # clojure-uk (8)
- # clojurescript (75)
- # code-reviews (1)
- # community-development (2)
- # conjure (88)
- # cryogen (5)
- # data-science (1)
- # datomic (3)
- # dirac (2)
- # fulcro (4)
- # helix (1)
- # jackdaw (5)
- # kaocha (5)
- # leiningen (2)
- # lsp (49)
- # malli (9)
- # mid-cities-meetup (1)
- # off-topic (8)
- # pathom (3)
- # polylith (19)
- # re-frame (6)
- # releases (3)
- # rewrite-clj (1)
- # shadow-cljs (98)
- # spacemacs (2)
- # tools-deps (6)
- # vim (4)
- # xtdb (6)
Heya folks! I’m continuing to think about custom skip support for the rewrite-clj zipper.
I’m thinking a :skip-pred
option at zipper creation time as suggested-ish in https://github.com/clj-commons/rewrite-clj/issues/70 .
As those in the know know, the current skip behaviour is hardcoded to skip Clojure whitespace and comments.
The :skip-pred
will allow folks to skip whatever nodes they like.
For example to skip all nodes that are not sexpr-able a :skip-pred
might be set to:
#(z/find % z/up* (complement z/sexpr-able?))
This says, I’m not interested in seeing nodes where the node or any of its parents are not sexpr-able.
This seems good to me, but am always happy to hear feedback.
Things get a little interesting if :skip-pred
is very restrictive and makes me wonder what moving up
and down
might mean.
For example, if I want to skip everything but comments, there is no down
on a comment, so fine, but up
? I suppose it would always navigate to the zipper root node?
Or if we skip everything but a container node, let’s say a set, we would see all sets, but unless a set contained a set we would not otherwise see its children through navigation. If set1 contains a vector that contains set2, it seems to me that an up
on set2 would bring me to set1. Would a down
on set1 bring me to set2? I’m not sure yet, but these are the kinds of questions that are coming to mind.