Fork me on GitHub
#specter
<
2018-01-14
>
mbjarland14:01:01

@nathanmarz wow…that is some kung-fu. Am I reading that right that we are essentially selecting a bunch of nodes in the datastructure as targets for the setval and then assigning using a vector and out comes the transformed data structure? That is perhaps the coolest statement I’ve seen so far from specter. I rewrote the subseelct path as (subselect ALL (pred :repeat) :apply-for), seems to do the same thing. Naturally the reward for an awesome answer is another question…is there a way in specter to select the node after a node we match in a vector, i.e. assume a vector:

[:a :b :c :d :e 1 :f :g]
and I would like to select the item after :e

nathanmarz14:01:23

subselect lets you manipulate an arbitrary selection path as a sequence, where changes to the sequence apply at the original locations

nathanmarz14:01:12

@mbjarland you can do that with zippers

nathanmarz14:01:31

also possible with srange-dynamic

nathanmarz14:01:50

or you can make a custom navigator