This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-05
Channels
- # arachne (7)
- # architecture (3)
- # beginners (106)
- # cider (22)
- # clara (2)
- # cljs-dev (14)
- # cljsrn (12)
- # clojure (121)
- # clojure-china (1)
- # clojure-italy (2)
- # clojure-spec (22)
- # clojure-uk (32)
- # clojurescript (38)
- # community-development (45)
- # cursive (15)
- # datascript (6)
- # datomic (12)
- # defnpodcast (2)
- # emacs (8)
- # events (1)
- # fulcro (14)
- # immutant (6)
- # jobs (3)
- # jobs-discuss (6)
- # jobs-rus (3)
- # keechma (4)
- # keyboards (4)
- # leiningen (8)
- # luminus (1)
- # off-topic (91)
- # onyx (13)
- # parinfer (36)
- # re-frame (12)
- # reagent (23)
- # remote-jobs (1)
- # ring-swagger (3)
- # shadow-cljs (57)
- # specter (11)
- # sql (9)
- # uncomplicate (4)
- # vim (2)
- # yada (15)
Which macro provides the ability to select nodes from a tree whose subpath matches a pattern? e.g. Given (def foo {"a1" {:z :c1, :d "e1"} "a2" {:z :c2, :d "e2"}}) (select [ALL (magic [VAL :z :c1])] foo) > {"a1" {:z :c1, :d "e1"} } What is the magic macro? Should I be using transform instead of select?
@phreed you're looking to filter submaps that don't contain a key-value pair [:z :c1]
?
@nathanmarz yes, I think that is right.
the basic pattern for that is (setval <path> NONE data)
in this case (setval [MAP-VALS (not-selected? :z (pred= :c1))] NONE foo)
I am looking at the documentation for not-selected?
it appears to take only one argument, a path. What is going on here (not-selected? :z (pred= :c1))
that looks like two arguments. Is it equivalent to (not-selected? [:z (pred= :c1)])
?
@phreed yes, those are equivalent
similarly the path [:a :b :c]
is the same as [[:a] [[:b]] :c]
a path is just a composition of navigators
a vector in a path is interpreted as a path