(prewalk-replace smap form)
Recursively transforms form by replacing keys in smap with their values. Like clojure/replace but works on any data structure. Does replacement at the root of the tree first.
user=> (clojure.walk/prewalk-replace '{a b} '(c (d a)))
(c (d b))
(use 'clojure.walk)
(prewalk-replace {:a 1 :b 2} [:a :b])
;=> [1 2]
(prewalk-replace {:a 1 :b 2} [:a :b :c])
;=> [1 2 :c]
(prewalk-replace {:a 1 :b 2} [:a :b [:a :b] :c])
;=> [1 2 [1 2] :c]