Fork me on GitHub
#specter
<
2019-02-19
>
axrs02:02:56

Is it possible to insert a value after a predicate match with specter? I thought AFTER-ELEM would work, but it converts map to a sequence ([:spec :test-2] :inserted) Something like:

(sp/setval 
  [sp/ALL (comp (partial = :test-2) :spec) sp/AFTER] 
  :inserted 
  [{:spec :test} {:spec :test-2} {:spec :test-3}])
I'm looking for the result to be: [{:spec :test} {:spec :test-2} :inserted {:spec :test-3}]

nathanmarz13:02:37

@axrs ALL navigates you into the value, so you're no longer in the context of the sequence

nathanmarz13:02:01

you can accomplish your goal by using the zipper navigators