Zipper support for tinsel.
Zipper support for tinsel.
(do-tree do-fn start-loc)(do-tree do-fn start-loc next-fn)Applies the first argument to the nodes of the tree, moving to the next node by moving to the result of the next-fn argument applied to the current node until the end is reached. By default, the next-fn argument is zip/next. Not lazy, so do-fn can have side-effects.
Applies the first argument to the nodes of the tree, moving to the next node by moving to the result of the next-fn argument applied to the current node until the end is reached. By default, the next-fn argument is zip/next. Not lazy, so do-fn can have side-effects.
(hiccup-zip root)Returns a zipper for Hiccup forms, given a root form.
Returns a zipper for Hiccup forms, given a root form.
(leftmost-descendant loc)Given a zipper loc, returns its leftmost descendent (ie, down repeatedly).
Given a zipper loc, returns its leftmost descendent (ie, down repeatedly).
(postorder-first loc)Given a root node, returns the first node of a postorder tree walk. See comment on postorder-next.
Given a root node, returns the first node of a postorder tree walk. See comment on postorder-next.
(postorder-next loc)Moves to the next loc in the hierarchy in postorder traversal. Behaves like clojure.zip/next otherwise. Note that unlike with a pre-order walk, the root is NOT the first element in the walk order, so be sure to take that into account in your algorithm if it matters (ie, call postorder-first first thing before processing a node).
Moves to the next loc in the hierarchy in postorder traversal. Behaves like clojure.zip/next otherwise. Note that unlike with a pre-order walk, the root is NOT the first element in the walk order, so be sure to take that into account in your algorithm if it matters (ie, call postorder-first first thing before processing a node).
(print-tree start-loc)(print-tree start-loc next-fn)Prints the nodes of the tree by repeatedly applying the argument function to the location until the end is reached. By default, the next-fn argument is zip/next.
Prints the nodes of the tree by repeatedly applying the argument function to the location until the end is reached. By default, the next-fn argument is zip/next.
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 |