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