This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-06
Channels
- # bangalore-clj (2)
- # beginners (55)
- # boot (32)
- # bristol-clojurians (4)
- # cider (16)
- # clara (13)
- # cljsrn (6)
- # clojure (110)
- # clojure-india (1)
- # clojure-italy (69)
- # clojure-spec (32)
- # clojure-uk (15)
- # clojurescript (102)
- # community-development (6)
- # cursive (1)
- # datomic (9)
- # docs (2)
- # duct (1)
- # emacs (39)
- # events (3)
- # fulcro (131)
- # garden (1)
- # immutant (4)
- # jobs (1)
- # jobs-discuss (5)
- # keechma (1)
- # lein-figwheel (6)
- # leiningen (6)
- # mount (6)
- # nrepl (2)
- # off-topic (69)
- # om (54)
- # parinfer (7)
- # re-frame (63)
- # reagent (13)
- # remote-jobs (1)
- # shadow-cljs (90)
- # spacemacs (8)
- # specter (6)
- # sql (16)
- # testing (1)
- # unrepl (3)
- # vim (4)
- # yada (1)
Hi, I have a nested data structure like in the snippet above. I can select all the nodes of a specified type, but I’m having trouble updating them. I want the index of the node I am updating within the transform function. Any pointers on how to do this? Thanks
@jamescroft you can do that with subselect
and a slightly modified NODES
(def NODES (recursive-path [] p (stay-then-continue (must :nodes) ALL p)))
(transform [(subselect NODES #(= "a" (:type %)) :index) (view count)] range data)
@nathanmarz great thanks! I wouldn’t have got there on my own!
sure thing
I highly recommend skimming through https://github.com/nathanmarz/specter/wiki/List-of-Navigators to learn what's available