In spectre, I use this function to change every timestamp value in an atom: (transform [:section MAP-VALS :timestamp] (constantly "03:30") atom) But that applies the same value to every timestamp. What I want to do is take every timestamp from a vector of timestamps (def times ["00:00" "00:03" "00:10" etc] and add each one to each :section timestamp. I currently use reduce to do this and increment an index, but i do this kind of thing a lot and wondered if spectre has a simpler way to do it? I know that (transform [:section MAP-VALS :timestamp] produces a vector of those times, so is there a way to just replace that vector with my other one, allowing transform to reverse it's navigation with the new vector?
like this?
(def data
{:section {:a {:timestamp 1}
:b {:timestamp 2}
:c {:timestamp 3}}})
(setval (subselect :section MAP-VALS :timestamp) [10 11 12 13] data)
;; => {:section {:a {:timestamp 10}, :b {:timestamp 11}, :c {:timestamp 12}}}That's exactly it, thank you kindly. Currently changing lots of code to use spectre and it's reducing complexity by a hefty amount :)