Depth-first traversal that tracks the return from each visit. It yields visits when they complete (post-order), evaluates bottom-up folds, and produces the depth-first trace.
Depth-first traversal that tracks the return from each visit. It yields visits when they complete (post-order), evaluates bottom-up folds, and produces the depth-first trace.
(complete space
starts
{:keys [caller decode-edge prepare-visit initialize global-key refine]
:as opts}
fold
trace?)Lazily runs a depth-first traversal to completion of each visit. Yields completed visits, or the whole trace when trace? is true. An optional fold computes a :value for each completed visit from its successors' values.
The active visit is held in loop locals. Its suspended ancestors are stacked as frames of [visit key accumulator remaining-successors transition-to-child], so depth never grows the JVM call stack. Starting states are consumed one at a time once the frames are empty.
When each key is visited once per search, known maps every entered key to what is known about it. With a fold that shares results per key, that is the visit itself, replaced on completion by the visit carrying its :value. Otherwise it is :active, and a trace, which reports whether a repeated key is still on the current path, changes it to :done on completion.
Lazily runs a depth-first traversal to completion of each visit. Yields completed visits, or the whole trace when trace? is true. An optional fold computes a :value for each completed visit from its successors' values. The active visit is held in loop locals. Its suspended ancestors are stacked as frames of [visit key accumulator remaining-successors transition-to-child], so depth never grows the JVM call stack. Starting states are consumed one at a time once the frames are empty. When each key is visited once per search, known maps every entered key to what is known about it. With a fold that shares results per key, that is the visit itself, replaced on completion by the visit carrying its :value. Otherwise it is :active, and a trace, which reports whether a repeated key is still on the current path, changes it to :done on completion.
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 |