Liking cljdoc? Tell your friends :D

cascade.hike

What is a hike, but a really long walk?

Like clojure.walk, but defines walk in a way that supports walking very large, nested data structures without using the call stack.

Defines recursive tree operations for Clojure data structures. Functions in this namespace take any data structure (list, vector, map, set, seq) and traverses those forms.

cascade.hike/walk is a generic tree walker that uses continuation-passing and returns thunks. It takes any data structure, calls a function with a continuation on every element, and uses the value passed into the continuation in place of the original. This makes it easier to write recursive search-and-replace functions for very nested data that do not use the call stack, as shown in the rest of the functions in this namespace.

What is a hike, but a really long walk?

Like clojure.walk, but defines `walk` in a way that supports walking very
large, nested data structures without using the call stack.

Defines recursive tree operations for Clojure data structures. Functions in
this namespace take any data structure (list, vector, map, set, seq) and
traverses those forms.

`cascade.hike/walk` is a generic tree walker that uses continuation-passing
and returns thunks. It takes any data structure, calls a function with a
continuation on every element, and uses the value passed into the continuation
in place of the original. This makes it easier to write recursive search-and-replace
functions for very nested data that do not use the call stack, as shown in the
rest of the functions in this namespace.
raw docstring

keywordize-keysclj/s

(keywordize-keys m)

Recursively transforms all map keys from strings to keywords. Works for very nested data.

Recursively transforms all map keys from strings to keywords.
Works for very nested data.
sourceraw docstring

macroexpand-allclj

(macroexpand-all form)

Recursively performs all possible macroexpansions in form. Works for very nested forms.

Recursively performs all possible macroexpansions in form. Works for very
nested forms.
sourceraw docstring

postwalkclj/s

(postwalk f form)

Like clojure.walk/postwalk, but works for very nested forms. 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.

Like `clojure.walk/postwalk`, but works for very nested forms.
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-replaceclj/s

(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. Works for very nested forms.

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. Works for very nested forms.
sourceraw docstring

prewalkclj/s

(prewalk f form)

Like clojure.walk/prewalk, but works for very nested forms. Similar to postwalk but does pre-order traversal.

Like `clojure.walk/prewalk`, but works for very nested forms.
Similar to `postwalk` but does pre-order traversal.
sourceraw docstring

prewalk-replaceclj/s

(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. Works for very nested forms.

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. Works for very nested forms.
sourceraw docstring

pruneclj/s

(prune pred form)

Traverses form, removing all elements that (pred el) returns truthy. Works for very nested forms.

When an element is a map key and pred returns truthy, dissocs the entry from the map.

Traverses `form`, removing all elements that (pred el) returns truthy.
Works for very nested forms.

When an element is a map key and `pred` returns truthy, dissocs the entry
from the map.
sourceraw docstring

seekclj/s

(seek pred form)

Traverses form, returning the first element that (pred el) is true or nil. Works for very nested forms.

May call pred multiple times per element.

Traverses `form`, returning the first element that (pred el) is true or nil.
Works for very nested forms.

May call `pred` multiple times per element.
sourceraw docstring

stringify-keysclj/s

(stringify-keys m)

Recursively transforms all map keys from keywords to strings. Works for very nested data.

Recursively transforms all map keys from keywords to strings.
Works for very nested data.
sourceraw docstring

transform-keysclj/s

(transform-keys f form)

Recursively transforms all map keys via (f k). Works for very nested data.

Recursively transforms all map keys via `(f k)`.
Works for very nested data.
sourceraw docstring

walkclj/s

(walk inner outer form)

Continuation-passing style, trampolined version of clojure.walk/walk.

Traverses form, an arbitrary data structure. inner is a function that accepts a continuation and a value. outer is a funcion that accepts a single value.

Calls (inner k el) for each element of form, building up a data structure of the same type, then calls (outer result). When k is called, it will continue the traversal to the next element in the structure. If not called, this short-circuits the traversal and whatever value is returned by inner will be passed to outer.

Returns a single-arity function for use with trampoline. See prewalk and postwalk for more user-friendly variations.

Continuation-passing style, trampolined version of `clojure.walk/walk`.

Traverses `form`, an arbitrary data structure. `inner` is a function that
accepts a continuation and a value. `outer` is a funcion that accepts
a single value.

Calls (inner k el) for each element of `form`, building up a data structure of
the same type, then calls (outer result). When `k` is called, it will continue
the traversal to the next element in the structure. If not called, this
short-circuits the traversal and whatever value is returned by `inner` will be
passed to `outer`.

Returns a single-arity function for use with `trampoline`.
See `prewalk` and `postwalk` for more user-friendly variations.
sourceraw docstring

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

× close