Liking cljdoc? Tell your friends :D

clojure.walk

This file defines a generic tree walker for Clojure data structures. It takes any data structure (list, vector, map, set, seq), calls a function on every element, and uses the return value of the function in place of the original. This makes it fairly easy to write recursive search-and-replace functions, as shown in the examples.

Note: "walk" supports all Clojure data structures EXCEPT maps created with sorted-map-by. There is no (obvious) way to retrieve the sorting function.

This file defines a generic tree walker for Clojure data
structures.  It takes any data structure (list, vector, map, set,
seq), calls a function on every element, and uses the return value
of the function in place of the original.  This makes it fairly
easy to write recursive search-and-replace functions, as shown in
the examples.

Note: "walk" supports all Clojure data structures EXCEPT maps
created with sorted-map-by.  There is no (obvious) way to retrieve
the sorting function.
raw docstring

keywordize-keyscljs

(keywordize-keys m)

Recursively transforms all map keys from strings to keywords.

Recursively transforms all map keys from strings to keywords.
sourceraw docstring

postwalkcljs

(postwalk f form)

Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall.

Performs a depth-first, post-order traversal of form.  Calls f on
each sub-form, uses f's return value in place of the original.
Recognizes all Clojure data structures. Consumes seqs as with doall.
sourceraw docstring

postwalk-replacecljs

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

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.
sourceraw docstring

prewalkcljs

(prewalk f form)

Like postwalk, but does pre-order traversal.

Like postwalk, but does pre-order traversal.
sourceraw docstring

prewalk-replacecljs

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

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.
sourceraw docstring

stringify-keyscljs

(stringify-keys m)

Recursively transforms all map keys from keywords to strings.

Recursively transforms all map keys from keywords to strings.
sourceraw docstring

walkcljs

(walk inner outer form)

Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures. Consumes seqs as with doall.

Traverses form, an arbitrary data structure.  inner and outer are
functions.  Applies inner to each element of form, building up a
data structure of the same type, then applies outer to the result.
Recognizes all Clojure data structures. Consumes seqs as with doall.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close