I’m trying to mimic Clojure’s update but I’m struggling to understand how to do sort of in-place updates to maps using match:
(m/match {:a 1 :b 3}
{:a ?a & _}
{:a (inc ?a)
????})
In this small example I’m trying to perform inc only on :a (and perhaps do that for several other keywords, but this is the basic form of what I’m trying to do).
How do you stitch back the “rest” of the map?Perhaps you want m/rewrite?
`
I thought rewrite outputs a match pattern given an input which you can match against
(m/rewrite {:a 1 :b 3}
{:a ?a & ?m}
{:a (m/app inc ?a) & ?m})rewrite’s “action” branch is pattern-like, as opposed to match/search/find which are more like literal clojure
“action” is the second parameter in this case, right?