(add-history zip command)
adds elements to the zipper history
adds elements to the zipper history
(bottom-most? zip)
check if at bottom-most point of a branch
(-> (zip/from-cursor '[1 2 [3 4 |]]) (bottom-most?)) => true
check if at bottom-most point of a branch (-> (zip/from-cursor '[1 2 [3 4 |]]) (bottom-most?)) => true
(delete-left {:keys [left] :as zip})
(delete-left zip num)
delete element/s left of the current position
(-> (zip/from-cursor '[1 2 | 3]) (delete-left) (zip/cursor)) => '([1 | 3])
delete element/s left of the current position (-> (zip/from-cursor '[1 2 | 3]) (delete-left) (zip/cursor)) => '([1 | 3])
(delete-right {:keys [right] :as zip})
(delete-right zip num)
delete element/s right of the current position
(-> (zip/from-cursor '[1 2 | 3]) (delete-right) (zip/cursor)) => '([1 2 |])
delete element/s right of the current position (-> (zip/from-cursor '[1 2 | 3]) (delete-right) (zip/cursor)) => '([1 2 |])
(history zip)
accesses the zipper history
(-> (vector-zip [1 [2 3]]) (move-down) (move-right) (history)) => [[:down] [:right]]
accesses the zipper history (-> (vector-zip [1 [2 3]]) (move-down) (move-right) (history)) => [[:down] [:right]]
(insert-left zip element)
(insert-left zip element & more)
insert element/s left of the current position
(-> (zip/from-cursor '[1 2 [[| 3] 4]]) (insert-left 1 2 3) (zip/cursor)) => '([1 2 [[1 2 3 | 3] 4]])
insert element/s left of the current position (-> (zip/from-cursor '[1 2 [[| 3] 4]]) (insert-left 1 2 3) (zip/cursor)) => '([1 2 [[1 2 3 | 3] 4]])
(insert-right zip element)
(insert-right zip element & more)
insert element/s right of the current position
(-> (zip/from-cursor '[| 1 2 3]) (insert-right 1 2 3) (zip/cursor)) => '([| 3 2 1 1 2 3])
insert element/s right of the current position (-> (zip/from-cursor '[| 1 2 3]) (insert-right 1 2 3) (zip/cursor)) => '([| 3 2 1 1 2 3])
(left-most? zip)
check if at left-most point of a branch
(-> (zip/from-cursor [1 2 ['| 3 4]]) (left-most?)) => true
check if at left-most point of a branch (-> (zip/from-cursor [1 2 ['| 3 4]]) (left-most?)) => true
(left-node zip)
element directly left of current position
(-> (zip/from-cursor '[1 2 3 | 4]) (left-node)) => 3
element directly left of current position (-> (zip/from-cursor '[1 2 3 | 4]) (left-node)) => 3
(left-nodes zip)
all elements left of current position
(-> (zip/from-cursor '[1 2 | 3 4]) (left-nodes)) => '(1 2)
all elements left of current position (-> (zip/from-cursor '[1 2 | 3 4]) (left-nodes)) => '(1 2)
(move-bottom-most zip)
move to bottom-most point of current branch
(-> (zip/from-cursor '[1 2 | [[3] 4]]) (move-bottom-most) (zip/cursor)) => '([1 2 [[| 3] 4]])
move to bottom-most point of current branch (-> (zip/from-cursor '[1 2 | [[3] 4]]) (move-bottom-most) (zip/cursor)) => '([1 2 [[| 3] 4]])
(move-down zip)
(move-down zip num)
move down from current position
(-> (zip/from-cursor '[1 2 | [3 4]]) (move-down) (zip/cursor)) => '([1 2 [| 3 4]])
move down from current position (-> (zip/from-cursor '[1 2 | [3 4]]) (move-down) (zip/cursor)) => '([1 2 [| 3 4]])
(move-down? zip)
check if can move down from current position
(-> (zip/from-cursor '[1 2 [3 4 |]]) (move-down?)) => false
(-> (zip/from-cursor '[1 2 | [3 4]]) (move-down?)) => true
check if can move down from current position (-> (zip/from-cursor '[1 2 [3 4 |]]) (move-down?)) => false (-> (zip/from-cursor '[1 2 | [3 4]]) (move-down?)) => true
(move-left {:keys [left right] :as zip})
(move-left zip num)
move left from current position
(-> (zip/from-cursor '[1 2 [3 4 |]]) (move-left) (zip/cursor)) => '([1 2 [3 | 4]])
move left from current position (-> (zip/from-cursor '[1 2 [3 4 |]]) (move-left) (zip/cursor)) => '([1 2 [3 | 4]])
(move-left-most zip)
move to left-most point of current branch
(-> (zip/from-cursor '[1 2 [3 4 |]]) (move-left-most) (zip/cursor)) => '([1 2 [| 3 4]])
move to left-most point of current branch (-> (zip/from-cursor '[1 2 [3 4 |]]) (move-left-most) (zip/cursor)) => '([1 2 [| 3 4]])
(move-left? zip)
check if can move left from current position
(-> (zip/from-cursor '[1 2 [3 | 4]]) (move-left?)) => true
(-> (zip/from-cursor '[1 2 [| 3 4]]) (move-left?)) => false
check if can move left from current position (-> (zip/from-cursor '[1 2 [3 | 4]]) (move-left?)) => true (-> (zip/from-cursor '[1 2 [| 3 4]]) (move-left?)) => false
(move-right {:keys [left right] :as zip})
(move-right zip num)
move right from current position
(-> (zip/from-cursor '[1 2 [| 3 4]]) (move-right) (zip/cursor)) => '([1 2 [3 | 4]])
move right from current position (-> (zip/from-cursor '[1 2 [| 3 4]]) (move-right) (zip/cursor)) => '([1 2 [3 | 4]])
(move-right-most zip)
move to right-most point of current branch
(-> (zip/from-cursor '[1 2 [| 3 4]]) (move-right-most) (zip/cursor)) => '([1 2 [3 4 |]])
move to right-most point of current branch (-> (zip/from-cursor '[1 2 [| 3 4]]) (move-right-most) (zip/cursor)) => '([1 2 [3 4 |]])
(move-right? zip)
check if can move right from current position
(-> (zip/from-cursor '[1 2 [3 | 4]]) (move-right?)) => true
(-> (zip/from-cursor '[1 2 [3 4 |]]) (move-right?)) => false
check if can move right from current position (-> (zip/from-cursor '[1 2 [3 | 4]]) (move-right?)) => true (-> (zip/from-cursor '[1 2 [3 4 |]]) (move-right?)) => false
(move-top-most zip)
move to top-most point of the tree
(-> (zip/from-cursor '[1 2 [| 3 4]]) (move-top-most) (zip/cursor)) => '(| [1 2 [3 4]])
move to top-most point of the tree (-> (zip/from-cursor '[1 2 [| 3 4]]) (move-top-most) (zip/cursor)) => '(| [1 2 [3 4]])
(move-up zip)
(move-up zip num)
move up from current position
(-> (zip/from-cursor '[1 2 [| 3 4]]) (move-up) (zip/cursor)) => '([1 2 | [3 4]])
move up from current position (-> (zip/from-cursor '[1 2 [| 3 4]]) (move-up) (zip/cursor)) => '([1 2 | [3 4]])
(move-up? zip)
check if can move up from current position
(-> (zip/from-cursor '[1 2 [3 4 |]]) (move-up?)) => true
check if can move up from current position (-> (zip/from-cursor '[1 2 [3 4 |]]) (move-up?)) => true
(replace-left {:keys [left] :as zip} element)
replace element left of the current position
(-> (zip/from-cursor '[1 2 | 3]) (replace-left "10") (zip/cursor)) => '([1 "10" | 3])
replace element left of the current position (-> (zip/from-cursor '[1 2 | 3]) (replace-left "10") (zip/cursor)) => '([1 "10" | 3])
(replace-right {:keys [right] :as zip} element)
replace element right of the current position
(-> (zip/from-cursor '[1 2 | 3]) (replace-right "10") (zip/cursor)) => '([1 2 | "10"])
replace element right of the current position (-> (zip/from-cursor '[1 2 | 3]) (replace-right "10") (zip/cursor)) => '([1 2 | "10"])
(right-most? zip)
check if at right-most point of a branch
(-> (zip/from-cursor '[1 2 [3 4 |]]) (right-most?)) => true
check if at right-most point of a branch (-> (zip/from-cursor '[1 2 [3 4 |]]) (right-most?)) => true
(right-node zip)
element directly right of current position
(-> (zip/from-cursor '[1 2 3 | 4]) (right-node)) => 4
element directly right of current position (-> (zip/from-cursor '[1 2 3 | 4]) (right-node)) => 4
(right-nodes zip)
all elements right of current position
(-> (zip/from-cursor '[1 2 | 3 4]) (right-nodes)) => '(3 4)
all elements right of current position (-> (zip/from-cursor '[1 2 | 3 4]) (right-nodes)) => '(3 4)
(seq-zip root)
constructs a sequence zipper
(seq-zip '(1 2 3 4 5)) => (contains {:left (), :right '((1 2 3 4 5)), :parent :top})
constructs a sequence zipper (seq-zip '(1 2 3 4 5)) => (contains {:left (), :right '((1 2 3 4 5)), :parent :top})
(siblings {:keys [left right] :as zip})
all elements left and right of current position
(-> (zip/from-cursor '[1 2 | 3 4]) (siblings)) => '(1 2 3 4)
(-> (zip/from-cursor '[1 [2 | 3] 4]) (siblings)) => '(2 3)
all elements left and right of current position (-> (zip/from-cursor '[1 2 | 3 4]) (siblings)) => '(1 2 3 4) (-> (zip/from-cursor '[1 [2 | 3] 4]) (siblings)) => '(2 3)
(top-most? zip)
check if at top-most point of the tree
(-> (zip/from-cursor [1 2 [3 4 '|]]) (top-most?)) => false
(-> (zip/from-cursor '[1 2 [3 4 |]]) (move-up) (move-up) (top-most?)) => true
check if at top-most point of the tree (-> (zip/from-cursor [1 2 [3 4 '|]]) (top-most?)) => false (-> (zip/from-cursor '[1 2 [3 4 |]]) (move-up) (move-up) (top-most?)) => true
(vector-zip root)
constructs a vector based zipper
(vector-zip [1 2 3 4 5]) => (contains {:left (), :right '([1 2 3 4 5]) :parent :top})
constructs a vector based zipper (vector-zip [1 2 3 4 5]) => (contains {:left (), :right '([1 2 3 4 5]) :parent :top})
(zipper root {:keys [branch? children make-node] :as meta})
constructs a zipper
(zipper '(1 2 3) {:branch? seq? :children identity :make-node identity}) => zipper?
constructs a zipper (zipper '(1 2 3) {:branch? seq? :children identity :make-node identity}) => zipper?
(zipper-meta meta)
checks that the meta contains valid functions
(zipper-meta {}) => (throws)
(zipper-meta {:branch? seq? :children identity :make-node identity}) => map?
checks that the meta contains valid functions (zipper-meta {}) => (throws) (zipper-meta {:branch? seq? :children identity :make-node identity}) => map?
(zipper? x)
checks to see if an object is a zipper
(zipper? 1) => false
checks to see if an object is a zipper (zipper? 1) => false
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close