Fork me on GitHub
#specter
<
2022-05-12
>
chromalchemy00:05:22

Here is a version

(multi-transform
  (multi-path
    [map? empty? :a (putval {}) :x NIL->VECTOR AFTER-ELEM (terminal-val 6)]
    [(must :a) vector? empty? BEFORE-ELEM (terminal-val {:x [6]})]
    [(must :a) vector? some? (nthpath 1) map? :x AFTER-ELEM  (terminal-val 6)])
  m)
Of course you could set more complex data with terminal-val (like setval), or swap out some of the navigation for clojure functions used with terminal (local transform function). And you could probably do it also with a normal cond + predicates, and a more simple navigation.