File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 94
94
(defn root
95
95
" zips all the way up and returns the root node, reflecting any
96
96
changes."
97
- [loc]
98
- (if ( = : end ( :path loc))
97
+ [{ :keys [end?] :as loc} ]
98
+ (if end?
99
99
(node loc)
100
100
(let [p (up loc)]
101
101
(if p
188
188
" Moves to the next loc in the hierarchy, depth-first. When reaching
189
189
the end, returns a distinguished loc detectable via end?. If already
190
190
at the end, stays there."
191
- [loc]
192
- (if ( = : end ( :path loc))
191
+ [{ :keys [end?] :as loc} ]
192
+ (if end?
193
193
loc
194
194
(or
195
195
(and (branch? loc) (down loc))
196
196
(right loc)
197
197
(loop [p loc]
198
198
(if (up p)
199
199
(or (right (up p)) (recur (up p)))
200
- (assoc p :path : end ))))))
200
+ (assoc p :end? true ))))))
201
201
202
202
(defn prev
203
203
" Moves to the previous loc in the hierarchy, depth-first. If already
213
213
(defn end?
214
214
" Returns true if loc represents the end of a depth-first walk"
215
215
[loc]
216
- (= :end ( :path loc) ))
216
+ (:end? loc))
217
217
218
218
(defn remove
219
219
" Removes the node at loc, returning the loc that would have preceded
You can’t perform that action at this time.
0 commit comments