(postwalk-reduce f acc form & more-forms)Performs a depth-first, post-order traversal of form, calling f with acc on each sub-form; f returns [new-acc new-form]. Recognizes all Clojure data structures. Consumes seqs as with doall.
Accepts optional trailing secondary collections (more-forms), walked in tandem with form (see walk-reduce for pairing rules). f is called as (apply f acc item secondary-item...) and still returns [new-acc new-item], transforming only the primary item. With no secondary collections, behaves exactly as before.
Performs a depth-first, post-order traversal of form, calling f with acc on each sub-form; f returns [new-acc new-form]. Recognizes all Clojure data structures. Consumes seqs as with doall. Accepts optional trailing secondary collections (more-forms), walked in tandem with form (see walk-reduce for pairing rules). f is called as (apply f acc item secondary-item...) and still returns [new-acc new-item], transforming only the primary item. With no secondary collections, behaves exactly as before.
(prewalk-reduce f acc form & more-forms)Like postwalk-reduce, but does pre-order traversal.
Accepts optional trailing secondary collections (more-forms), walked in tandem with form (see walk-reduce for pairing rules). With no secondary collections, behaves exactly as before.
Like postwalk-reduce, but does pre-order traversal. Accepts optional trailing secondary collections (more-forms), walked in tandem with form (see walk-reduce for pairing rules). With no secondary collections, behaves exactly as before.
(walk-reduce inner outer acc form & more-forms)Traverses form, an arbitrary data structure, while accumulating a result. Inner and outer are functions of (acc, item, & secondary-items) returning [acc item]. Recognizes all Clojure data structures. Consumes seqs as with doall.
Accepts optional trailing secondary collections (more-forms). form alone drives traversal shape/order; each collection in more-forms is walked in tandem, following the same path form's traversal takes, and its corresponding item is passed as an extra trailing argument to inner/outer. Only form's items are transformed and rebuilt; items from more-forms are read-only context.
Pairing: maps/records pair secondaries by key (missing/non-associative -> nil); sets pair secondaries by value/membership rather than position, since set iteration order is not semantically meaningful (missing/ non-set -> nil); vectors/lists/seqs pair by index (out-of-range/ non-sequential -> nil). With no secondary collections, behaves exactly as before.
Traverses form, an arbitrary data structure, while accumulating a result. Inner and outer are functions of (acc, item, & secondary-items) returning [acc item]. Recognizes all Clojure data structures. Consumes seqs as with doall. Accepts optional trailing secondary collections (more-forms). form alone drives traversal shape/order; each collection in more-forms is walked in tandem, following the same path form's traversal takes, and its corresponding item is passed as an extra trailing argument to inner/outer. Only form's items are transformed and rebuilt; items from more-forms are read-only context. Pairing: maps/records pair secondaries by key (missing/non-associative -> nil); sets pair secondaries by value/membership rather than position, since set iteration order is not semantically meaningful (missing/ non-set -> nil); vectors/lists/seqs pair by index (out-of-range/ non-sequential -> nil). With no secondary collections, behaves exactly as before.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |