Skip to main content

walk

Jump to function (7)

walk/keywordize-keys#

(keywordize-keys m)

Convert string map keys to keywords, recursively.

Example:

(keywordize-keys {"name" "phel"}) ; => {:name "phel"}

walk/postwalk#

(postwalk f form)

Bottom-up tree walk, applies f after recursing into children.

Example:

(postwalk inc [1 [2 3]]) ; => [2 [3 4]]

walk/postwalk-replace#

(postwalk-replace smap form)

Replace values bottom-up using a substitution map.

Example:

(postwalk-replace {:a :b} [:a :c]) ; => [:b :c]

walk/prewalk#

(prewalk f form)

Top-down tree walk, applies f before recursing into children.

Example:

(prewalk identity [1 [2 3]]) ; => [1 [2 3]]

walk/prewalk-replace#

(prewalk-replace smap form)

Replace values top-down using a substitution map.

Example:

(prewalk-replace {:a :b} [:a :c]) ; => [:b :c]

walk/stringify-keys#

(stringify-keys m)

Convert keyword map keys to strings, recursively.

Example:

(stringify-keys {:name "phel"}) ; => {"name" "phel"}

walk/walk#

(walk inner outer form)

Generic tree walker for nested data structures.

Example:

(walk inc identity [1 2 3]) ; => [2 3 4]