|
1 | | -(ns ^{ :doc "Base Operations for Zipper" |
| 1 | +(ns ^{ :doc "Base Operations for Zipper" |
2 | 2 | :author "Yannick Scherer" } |
3 | 3 | rewrite-clj.zip.core |
4 | 4 | (:require [fast-zip.core :as z] |
|
23 | 23 |
|
24 | 24 | (def edn |
25 | 25 | "Create zipper over rewrite-clj's EDN tree structure. The returned zipper location will |
26 | | - be the first non-whitespace node _inside_ a top-level `:forms` node. If the given tree |
| 26 | + be the first non-whitespace node _inside_ a top-level `:forms` node. If the given tree |
27 | 27 | is not a `:forms` node, it will be wrapped in one." |
28 | 28 | (fn [tree] |
29 | 29 | (skip-whitespace |
|
160 | 160 | path))) |
161 | 161 |
|
162 | 162 | (defn edit-node |
163 | | - "Apply given function to the given zipper location. Afterwards move the resulting |
| 163 | + "Apply given function to the given zipper location. Afterwards move the resulting |
164 | 164 | zipper to the same location as the original one." |
165 | 165 | [zloc f] |
166 | 166 | (if-let [eloc (f zloc)] |
|
179 | 179 |
|
180 | 180 | (defmacro edit-> |
181 | 181 | "Will pass arguments to `->`. Return value will be the state of the input node |
182 | | - after all modifications have been performed. This means that the result is |
| 182 | + after all modifications have been performed. This means that the result is |
183 | 183 | automatically 'zipped up' to represent the same location the macro was given. |
184 | 184 | This only works correctly if insertions/removals are limited to nodes below or right |
185 | 185 | of the input node (modification can occur anywhere)." |
|
189 | 189 |
|
190 | 190 | (defmacro edit->> |
191 | 191 | "Will pass arguments to `->>`. Return value will be the state of the input node |
192 | | - after all modifications have been performed. This means that the result is |
| 192 | + after all modifications have been performed. This means that the result is |
193 | 193 | automatically 'zipped up' to represent the same location the macro was given. |
194 | 194 | This only works correctly if insertions/removals are limited to nodes below or right |
195 | 195 | of the input node (modification can occur anywhere)." |
|
0 commit comments