This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-08
Channels
- # atlanta-clojurians (1)
- # beginners (116)
- # cider (70)
- # cljs-dev (11)
- # cljsrn (2)
- # clojure (218)
- # clojure-italy (7)
- # clojure-nl (14)
- # clojure-nlp (11)
- # clojure-spec (8)
- # clojure-uk (113)
- # clojurescript (86)
- # core-async (14)
- # cursive (24)
- # datomic (64)
- # duct (1)
- # emacs (3)
- # fulcro (20)
- # graphql (10)
- # jobs-rus (1)
- # london-clojurians (1)
- # luminus (1)
- # nyc (1)
- # off-topic (24)
- # onyx (1)
- # parinfer (1)
- # pedestal (14)
- # portkey (11)
- # re-frame (36)
- # reagent (9)
- # reitit (5)
- # ring (1)
- # shadow-cljs (197)
- # spacemacs (21)
- # specter (22)
- # sql (15)
- # tools-deps (5)
@nathanmarz sorry, one more thing I'm stuck on with the navigators above: I'd like the macros that call them to stop at any keys in not-selected?
, :locals
in this example, rather than just skipping them and navigating deeper. It would seem I just need to move the not-selected?
navigators into recursive-path
so navigation stops there and setval
will only apply the other predicates to elements above it, but that doesn't seem to be working for me, even using separate macros.
@sophiago you want it to stop navigation at map values whose key is not :locals
?
so stop navigation at any map?
or stop navigation at maps with a :locals
key?
So if I have {:foo "bar" :env [{:locals "baz"} {:locals {:baz "qux"}}]}
I can use a macro like setval
above and not have it delete {:baz "qux"}
I've been playing with it and it seems to come down to how I compose predicates in recursive paths
ok, so basically don't recurse into :locals
And more generally, I just want to decouple the recursion from the predicates I'm composing
(def maps-with-key-stop
(recursive-path [k] p
(cond-path map? (if-path (must k)
STAY
(stay-then-continue MAP-VALS p))
coll? (compact ALL p)
)))
(setval
[(maps-with-key-stop :locals)
ALL
(not-selected? FIRST (pred= :locals))
LAST
(complement coll?)]
NONE
data)
actually you probably want
(def maps-with-key-stop
(recursive-path [k] p
(cond-path map? (stay-then-continue
ALL
(not-selected? FIRST (pred= k))
LAST
p)
coll? (compact ALL p)
)))
I think I actually want this:
(def maps-with-key-stop
(recursive-path [k] p
(cond-path map? (stay-then-continue
ALL
(not-selected? FIRST (pred= k))
ALL
p)
coll? [ALL p])))
Except I'm trying to get the k
to be a collection and apply
isn't giving the same results
that's not what eachnav
is for
@sophiago I think you want:
(def maps-with-key-stop
(recursive-path [kset] p
(cond-path map? (stay-then-continue
ALL
(not-selected? FIRST (pred kset))
LAST
p)
coll? [ALL p]
)))