File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 43
43
(defn append-child
44
44
" Append item as child of the current location. Will insert a space if necessary."
45
45
[zloc item]
46
- (let [r (-> zloc z/down z/rightmost)
46
+ (let [r' (z/down zloc)
47
+ r (when r' (z/rightmost r'))
47
48
item (conv/->tree item)]
48
49
(if (or (not r) (not (z/node r)) (zc/whitespace? r))
49
50
(-> zloc (z/append-child item))
Original file line number Diff line number Diff line change 218
218
(-> root (z/assoc 2 5 ) z/sexpr) => #{1 2 5 }
219
219
(-> root (z/assoc 5 8 ) z/sexpr) => (throws IndexOutOfBoundsException)
220
220
(->> root (z/map #(z/edit % inc)) z/sexpr) => #{2 3 4 })
221
+ (let [root (z/of-string " {}" )]
222
+ root => z/seq?
223
+ root => z/map?
224
+ (z/sexpr root) => {}
225
+ (-> root (z/assoc :a 5 ) z/sexpr) => {:a 5 })
221
226
(let [root (z/of-string " {:a 1 :b 2}" )]
222
227
root => z/seq?
223
228
root => z/map?
You can’t perform that action at this time.
0 commit comments