(backspace nav)the reverse of insert
(-> (parse-string "(0 #|1 2 3)") (backspace) str) => "<0,1> (|0 2 3)"
the reverse of insert
(-> (parse-string "(0 #|1 2 3)")
(backspace)
str)
=> "<0,1> (|0 2 3)"(block nav)returns the current block
(block (from-status [1 [2 (construct/cursor) 3]])) => (construct/block 3)
returns the current block (block (from-status [1 [2 (construct/cursor) 3]])) => (construct/block 3)
(block? zip)(block? zip step)(children zip)(children zip step)(comment? zip)(comment? zip step)(container? zip)(container? zip step)(copy-nav-var _ name source)helper function for importing vars
(copy-nav-var ns '-tag- #'hara.code.block.base/block-tag) => #'-tag-
helper function for importing vars (copy-nav-var *ns* '-tag- #'hara.code.block.base/block-tag) => #'-tag-
(delete nav)deletes the current element
(-> (parse-string "( #|1 2 3)") (delete) str) => "<0,3> ( |2 3)"
deletes the current element
(-> (parse-string "( #|1 2 3)")
(delete)
str)
=> "<0,3> ( |2 3)"(delete-left nav)deletes left of the current expression
(-> (parse-string "(1 2 #|3)") (delete-left) str) => "<0,3> (1 |3)"
deletes left of the current expression
(-> (parse-string "(1 2 #|3)")
(delete-left)
str)
=> "<0,3> (1 |3)"(delete-right nav)deletes right of the current expression
(-> (parse-string "( #|1 2 3)") (delete-right) str) => "<0,3> ( |1 3)"
deletes right of the current expression
(-> (parse-string "( #|1 2 3)")
(delete-right)
str)
=> "<0,3> ( |1 3)"(display-navigator nav)displays a string representing the navigator
(-> (navigator [1 2 3 4]) (display-navigator)) => "<0,0> |[1 2 3 4]"
displays a string representing the navigator
(-> (navigator [1 2 3 4])
(display-navigator))
=> "<0,0> |[1 2 3 4]"(down nav)navigates into the form
(str (down (from-status [1 (construct/cursor) [2 3]]))) => "<0,4> [1 [|2 3]]"
navigates into the form (str (down (from-status [1 (construct/cursor) [2 3]]))) => "<0,4> [1 [|2 3]]"
(eof? zip)(eof? zip step)(expression? zip)(expression? zip step)(find-next-token nav data)moves tot the next token
(-> (parse-string "(#| [[3 2]] )") (find-next-token 2) str) => "<0,7> ( [[3 |2]] )"
moves tot the next token
(-> (parse-string "(#| [[3 2]] )")
(find-next-token 2)
str)
=> "<0,7> ( [[3 |2]] )"(from-status block)constructs a navigator from a given status
(str (from-status (construct/block [1 2 3 (construct/cursor) 4]))) => "<0,7> [1 2 3 |4]"
constructs a navigator from a given status (str (from-status (construct/block [1 2 3 (construct/cursor) 4]))) => "<0,7> [1 2 3 |4]"
(height zip)(height zip step)(info zip)(info zip step)(insert nav data)inserts an element and moves
(-> (parse-string "(#|0)") (insert 1) str) => "<0,3> (0 |1)"
inserts an element and moves
(-> (parse-string "(#|0)")
(insert 1)
str)
=> "<0,3> (0 |1)"(insert-empty nav data)inserts an element into an empty container
(-> (parse-string "( #| )") (insert-empty 1) str) => "<0,1> (|1 )"
inserts an element into an empty container
(-> (parse-string "( #| )")
(insert-empty 1)
str)
=> "<0,1> (|1 )"(insert-left nav data)inserts an element to the left
(-> (parse-string "(#|0)") (insert-left 1) str) => "<0,3> (1 |0)"
inserts an element to the left
(-> (parse-string "(#|0)")
(insert-left 1)
str)
=> "<0,3> (1 |0)"(insert-right nav data)inserts an element to the right
(-> (parse-string "(#|0)") (insert-right 1) str) => "<0,1> (|0 1)"
inserts an element to the right
(-> (parse-string "(#|0)")
(insert-right 1)
str)
=> "<0,1> (|0 1)"(left nav)moves to the left expression
(-> (parse-string "(1 [1 2 3] #|)") (left) str) => "<0,4> (1 |[1 2 3] )"
moves to the left expression
(-> (parse-string "(1 [1 2 3] #|)")
(left)
str)
=> "<0,4> (1 |[1 2 3] )"(left* nav)navigates to left element, including whitespace
(str (left* (from-status [1 (construct/cursor) 2]))) => "<0,2> [1| 2]"
navigates to left element, including whitespace (str (left* (from-status [1 (construct/cursor) 2]))) => "<0,2> [1| 2]"
(left-anchor nav)calculates the length to the last newline
(left-anchor (-> (navigator nil) (zip/step-right))) => 3
calculates the length to the last newline
(left-anchor (-> (navigator nil)
(zip/step-right)))
=> 3(left-expression nav)returns the expression on the left
(-> {:left [(construct/newline) (construct/block [1 2 3])]} (left-expression) (base/block-value)) => [1 2 3]
returns the expression on the left
(-> {:left [(construct/newline)
(construct/block [1 2 3])]}
(left-expression)
(base/block-value))
=> [1 2 3](left-expressions nav)returns all expressions on the left
(->> {:left [(construct/newline) (construct/block :b) (construct/space) (construct/space) (construct/block :a)]} (left-expressions) (mapv base/block-value)) => [:a :b]
returns all expressions on the left
(->> {:left [(construct/newline)
(construct/block :b)
(construct/space)
(construct/space)
(construct/block :a)]}
(left-expressions)
(mapv base/block-value))
=> [:a :b](left-most nav)moves to the left-most expression
(-> (parse-string "(1 [1 2 3] 3 4 #|)") (left-most) str) => "<0,1> (|1 [1 2 3] 3 4 )"
moves to the left-most expression
(-> (parse-string "(1 [1 2 3] 3 4 #|)")
(left-most)
str)
=> "<0,1> (|1 [1 2 3] 3 4 )"(left-most-token nav)moves to the left-most token
(-> (parse-string "(1 {} 2 3 #|4)") (left-most-token) str) "<0,10> (1 {} 2 |3 4)"
moves to the left-most token
(-> (parse-string "(1 {} 2 3 #|4)")
(left-most-token)
str)
"<0,10> (1 {} 2 |3 4)"
(left-most? nav)checks if navigator is at left-most
(-> (from-status [1 [(construct/cursor) 2 3]]) (left-most?)) => true
checks if navigator is at left-most
(-> (from-status [1 [(construct/cursor) 2 3]])
(left-most?))
=> true(left-token nav)moves to the left token
(-> (parse-string "(1 {} #|2 3 4)") (left-token) str) => "<0,1> (|1 {} 2 3 4)"
moves to the left token
(-> (parse-string "(1 {} #|2 3 4)")
(left-token)
str)
=> "<0,1> (|1 {} 2 3 4)"(length zip)(length zip step)(level-empty? nav)checks if current container has expressions
(-> (parse-string "( #| )") (level-empty?)) => true
checks if current container has expressions
(-> (parse-string "( #| )")
(level-empty?))
=> true(line-info nav)returns the line info for the current block
(line-info (parse-string "[1 \n 2 3]")) => {:row 1, :col 1, :end-row 2, :end-col 7}
returns the line info for the current block
(line-info (parse-string "[1 \n 2 3]"))
=> {:row 1, :col 1, :end-row 2, :end-col 7}(linebreak? zip)(linebreak? zip step)(linespace? zip)(linespace? zip step)(modifier? zip)(modifier? zip step)(navigator block)(navigator block opts)creates a navigator for the block
(str (navigator [1 2 3 4])) => "<0,0> |[1 2 3 4]"
creates a navigator for the block (str (navigator [1 2 3 4])) => "<0,0> |[1 2 3 4]"
(navigator? obj)checks if object is navigator
(navigator? (navigator [1 2 3 4])) => true
checks if object is navigator (navigator? (navigator [1 2 3 4])) => true
(next nav)moves to the next expression
(-> (parse-string "(#| [[3]] )") (next) (next) (next) str) => "<0,5> ( [[|3]] )"
moves to the next expression
(-> (parse-string "(#| [[3]] )")
(next)
(next)
(next)
str)
=> "<0,5> ( [[|3]] )"(next-anchor nav)moves to the next newline
(-> (parse-string "( \n \n#| [[3 \n]] )") (next-anchor) (:position)) => [3 0]
moves to the next newline
(-> (parse-string "( \n \n#| [[3 \n]] )")
(next-anchor)
(:position))
=> [3 0](next-token nav)moves to the next token
(-> (parse-string "(#|[[1 2 3 4]])") (next-token) str) => "<0,3> ([[|1 2 3 4]])"
moves to the next token
(-> (parse-string "(#|[[1 2 3 4]])")
(next-token)
str)
=> "<0,3> ([[|1 2 3 4]])"(parse-root string)parses the navigator from root string
(str (parse-root "a b c")) => "<0,0> |a b c"
parses the navigator from root string (str (parse-root "a b c")) => "<0,0> |a b c"
(parse-root-status string)parses string and creates a navigator from status
(str (parse-root-status "a b #|c")) => "<0,6> a b |c"
parses string and creates a navigator from status (str (parse-root-status "a b #|c")) => "<0,6> a b |c"
(parse-string string)creates a navigator from string
(str (parse-string "(2 #| 3 )")) => "<0,5> (2 | 3 )"
creates a navigator from string (str (parse-string "(2 #| 3 )")) => "<0,5> (2 | 3 )"
(position-left nav)moves the cursor to left expression
(-> (parse-string "( 2 #| 3 )") (position-left) str) => "<0,2> ( |2 3 )"
moves the cursor to left expression
(-> (parse-string "( 2 #| 3 )")
(position-left)
str)
=> "<0,2> ( |2 3 )"(position-right nav)moves the cursor the right expression
(-> (parse-string "(2 #| 3 )") (position-right) str) => "<0,9> (2 |3 )"
moves the cursor the right expression
(-> (parse-string "(2 #| 3 )")
(position-right)
str)
=> "<0,9> (2 |3 )"(prefixed zip)(prefixed zip step)(prev nav)moves to the previous expression
(-> (parse-string "([1 2 [3]] #|)") (prev) str) => "<0,7> ([1 2 [|3]] )"
moves to the previous expression
(-> (parse-string "([1 2 [3]] #|)")
(prev)
str)
=> "<0,7> ([1 2 [|3]] )"(prev-anchor nav)moves to the previous newline
(-> (parse-string "( \n \n [[3 \n]] #| )") (prev-anchor) (:position)) => [3 0]
(-> (parse-string "( #| )") (prev-anchor) (:position)) => [0 0]
moves to the previous newline
(-> (parse-string "( \n \n [[3 \n]] #| )")
(prev-anchor)
(:position))
=> [3 0]
(-> (parse-string "( #| )")
(prev-anchor)
(:position))
=> [0 0](prev-token nav)moves to the previous token
(-> (parse-string "(1 (2 3 [4])#|)") (prev-token) str) => "<0,9> (1 (2 3 [|4]))"
moves to the previous token
(-> (parse-string "(1 (2 3 [4])#|)")
(prev-token)
str)
=> "<0,9> (1 (2 3 [|4]))"(replace nav data)replaces an element at the cursor
(-> (parse-string "(0 #|1 2 3)") (position-right) (replace :a) str) => "<0,4> (0 |:a 2 3)"
replaces an element at the cursor
(-> (parse-string "(0 #|1 2 3)")
(position-right)
(replace :a)
str)
=> "<0,4> (0 |:a 2 3)"(right nav)moves to the expression on the right
(-> (parse-string "(#|[1 2 3] 3 4 ) ") (right) str) => "<0,10> ([1 2 3] |3 4 )"
moves to the expression on the right
(-> (parse-string "(#|[1 2 3] 3 4 ) ")
(right)
str)
=> "<0,10> ([1 2 3] |3 4 )"(right* nav)navigates to right element, including whitespace
(str (right* (from-status [(construct/cursor) 1 2]))) => "<0,2> [1| 2]"
navigates to right element, including whitespace (str (right* (from-status [(construct/cursor) 1 2]))) => "<0,2> [1| 2]"
(right-expression nav)returns the expression on the right
(-> {:right [(construct/newline) (construct/block [1 2 3])]} (right-expression) (base/block-value)) => [1 2 3]
returns the expression on the right
(-> {:right [(construct/newline)
(construct/block [1 2 3])]}
(right-expression)
(base/block-value))
=> [1 2 3](right-expressions nav)returns all expressions on the right
(->> {:right [(construct/newline) (construct/block :b) (construct/space) (construct/space) (construct/block :a)]} (right-expressions) (mapv base/block-value)) => [:b :a]
returns all expressions on the right
(->> {:right [(construct/newline)
(construct/block :b)
(construct/space)
(construct/space)
(construct/block :a)]}
(right-expressions)
(mapv base/block-value))
=> [:b :a](right-most nav)moves to the right-most expression
(-> (parse-string "(#|[1 2 3] 3 4 ) ") (right-most) str) => "<0,12> ([1 2 3] 3 |4 )"
moves to the right-most expression
(-> (parse-string "(#|[1 2 3] 3 4 ) ")
(right-most)
str)
=> "<0,12> ([1 2 3] 3 |4 )"(right-most-token nav)moves to the right-most token
(-> (parse-string "(#|1 {} 2 3 [4])") (right-most-token) str) => "<0,10> (1 {} 2 |3 [4])"
moves to the right-most token
(-> (parse-string "(#|1 {} 2 3 [4])")
(right-most-token)
str)
=> "<0,10> (1 {} 2 |3 [4])"(right-most? nav)checks if navigator is at right-most
(-> (from-status [1 [2 3 (construct/cursor)]]) (right-most?)) => true
checks if navigator is at right-most
(-> (from-status [1 [2 3 (construct/cursor)]])
(right-most?))
=> true(right-token nav)moves to the right token
(-> (parse-string "(#|1 {} 2 3 4)") (right-token) str) => "<0,8> (1 {} |2 3 4)"
moves to the right token
(-> (parse-string "(#|1 {} 2 3 4)")
(right-token)
str)
=> "<0,8> (1 {} |2 3 4)"(root-string nav)returns the top level string
(root-string (navigator [1 2 3 4])) => "[1 2 3 4]"
returns the top level string (root-string (navigator [1 2 3 4])) => "[1 2 3 4]"
(space? zip)(space? zip step)(string zip)(string zip step)(suffixed zip)(suffixed zip step)(tag zip)(tag zip step)(tighten nav)removes extra spaces on both the left and right
(-> (parse-string "(1 2 #|3 4)") (tighten) str) => "<0,5> (1 2 |3 4)"
removes extra spaces on both the left and right
(-> (parse-string "(1 2 #|3 4)")
(tighten)
str)
=> "<0,5> (1 2 |3 4)"(tighten-left nav)removes extra spaces on the left
(-> (parse-string "(1 2 3 #|4)") (tighten-left) str) => "<0,7> (1 2 3 |4)"
removes extra spaces on the left
(-> (parse-string "(1 2 3 #|4)")
(tighten-left)
str)
=> "<0,7> (1 2 3 |4)"(tighten-right nav)removes extra spaces on the right
(-> (parse-string "(1 2 #|3 4)") (tighten-right) str) => "<0,5> (1 2 |3 4)"
removes extra spaces on the right
(-> (parse-string "(1 2 #|3 4)")
(tighten-right)
str)
=> "<0,5> (1 2 |3 4)"(token? zip)(token? zip step)(type zip)(type zip step)(up nav)navigates outside of the form
(str (up (from-status [1 [2 (construct/cursor) 3]]))) => "<0,3> [1 |[2 3]]"
navigates outside of the form (str (up (from-status [1 [2 (construct/cursor) 3]]))) => "<0,3> [1 |[2 3]]"
(update-children nav children)replaces the current children
(-> (update-children (parse-string "[1 2 3]") [(construct/block 4) (construct/space) (construct/block 5)]) str) => "<0,0> |[4 5]"
replaces the current children
(-> (update-children (parse-string "[1 2 3]")
[(construct/block 4)
(construct/space)
(construct/block 5)])
str)
=> "<0,0> |[4 5]"(update-step-inside nav block)updates the step position to within a block (-> {:position [0 0]} (update-step-inside (construct/block #{}))) => {:position [0 2]}
updates the step position to within a block
(-> {:position [0 0]}
(update-step-inside (construct/block #{})))
=> {:position [0 2]}(update-step-inside-left nav block)updates the step position to within a block (-> {:position [0 3]} (update-step-inside-left (construct/block #{}))) => {:position [0 2]}
updates the step position to within a block
(-> {:position [0 3]}
(update-step-inside-left (construct/block #{})))
=> {:position [0 2]}(update-step-left nav lblock)updates the step position to the left
(-> {:position [0 7]} (update-step-left (construct/block [1 2 3]))) => {:position [0 0]}
updates the step position to the left
(-> {:position [0 7]}
(update-step-left (construct/block [1 2 3])))
=> {:position [0 0]}(update-step-outside nav left-blocks)updates the step position to be outside a block
(let [left-elems [(construct/block [1 2 3]) (construct/newline)]] (-> {:position [1 0] :left left-elems} (update-step-outside left-elems) :position)) => [0 7]
updates the step position to be outside a block
(let [left-elems [(construct/block [1 2 3]) (construct/newline)]]
(-> {:position [1 0]
:left left-elems}
(update-step-outside left-elems)
:position))
=> [0 7](update-step-right nav block)updates the step position to the right
(-> {:position [0 0]} (update-step-right (construct/block [1 2 3]))) => {:position [0 7]}
updates the step position to the right
(-> {:position [0 0]}
(update-step-right (construct/block [1 2 3])))
=> {:position [0 7]}(value zip)(value zip step)(value-string zip)(value-string zip step)(verify zip)(verify zip step)(void? zip)(void? zip step)(width zip)(width zip step)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 |