(postwalk-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 leaves of the tree first.
(use 'clojure.walk)
(postwalk-replace {:a 1 :b 2} [:a :b])
;=> [1 2]
(postwalk-replace {:a 1 :b 2} [:a :b :c])
;=> [1 2 :c]
(postwalk-replace {:a 1 :b 2} [:a :b [:a :b] :c])
;=> [1 2 [1 2] :c]
(postwalk-replace {nil :NIL} {:a 1, :b nil, :c 3, nil 4})
;=> {:NIL 4, :a 1, :b :NIL, :c 3}