1.3.0 permalink Arrow_down_16x16

prewalk-replace

clojure.walk

  • (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.

1 Example top

  • user=> (clojure.walk/prewalk-replace '{a b} '(c (d a)))
    (c (d b))
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/walk.clj:107 top

(defn prewalk-replace
  "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."
  {:added "1.1"}
  [smap form]
  (prewalk (fn [x] (if (contains? smap x) (smap x) x)) form))
Vars in clojure.walk/prewalk-replace:
Used in 0 other vars

Comments top

No comments for prewalk-replace. Log in to add a comment.