Liking cljdoc? Tell your friends :D

hara.code.navigate


backspaceclj

(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)"
raw docstring

blockclj

(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)
raw docstring

block?clj

(block? zip)
(block? zip step)

childrenclj

(children zip)
(children zip step)

comment?clj

(comment? zip)
(comment? zip step)

container?clj

(container? zip)
(container? zip step)

copy-nav-varclj

(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-
raw docstring

deleteclj

(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)"
raw docstring

delete-leftclj

(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)"
raw docstring

delete-rightclj

(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)"
raw docstring

display-navigatorclj

(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]"
raw docstring

downclj

(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]]"
raw docstring

eof?clj

(eof? zip)
(eof? zip step)

expression?clj

(expression? zip)
(expression? zip step)

find-next-tokenclj

(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]]  )"
raw docstring

from-statusclj

(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]"
raw docstring

heightclj

(height zip)
(height zip step)

infoclj

(info zip)
(info zip step)

insertclj

(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)"
raw docstring

insert-emptyclj

(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  )"
raw docstring

insert-leftclj

(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)"
raw docstring

insert-rightclj

(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)"
raw docstring

leftclj

(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]    )"
raw docstring

left*clj

(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]"
raw docstring

left-anchorclj

(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
raw docstring

left-expressionclj

(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]
raw docstring

left-expressionsclj

(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]
raw docstring

left-mostclj

(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   )"
raw docstring

left-most-tokenclj

(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)"
raw docstring

left-most?clj

(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
raw docstring

left-tokenclj

(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)"
raw docstring

lengthclj

(length zip)
(length zip step)

level-empty?clj

(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
raw docstring

line-infoclj

(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}
raw docstring

linebreak?clj

(linebreak? zip)
(linebreak? zip step)

linespace?clj

(linespace? zip)
(linespace? zip step)

modifier?clj

(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]"
raw docstring

(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
raw docstring

nextclj

(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]]  )"
raw docstring

next-anchorclj

(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]
raw docstring

next-tokenclj

(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]])"
raw docstring

parse-rootclj

(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"
raw docstring

parse-root-statusclj

(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"
raw docstring

parse-stringclj

(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  )"
raw docstring

position-leftclj

(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  )"
raw docstring

position-rightclj

(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  )"
raw docstring

prefixedclj

(prefixed zip)
(prefixed zip step)

prevclj

(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]] )"
raw docstring

prev-anchorclj

(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]
raw docstring

prev-tokenclj

(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]))"
raw docstring

replaceclj

(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)"
raw docstring

(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  )"
raw docstring

right*clj

(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]"
raw docstring

right-expressionclj

(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]
raw docstring

right-expressionsclj

(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]
raw docstring

right-mostclj

(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  )"
raw docstring

right-most-tokenclj

(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])"
raw docstring

right-most?clj

(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
raw docstring

right-tokenclj

(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)"
raw docstring

root-stringclj

(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]"
raw docstring

space?clj

(space? zip)
(space? zip step)

stringclj

(string zip)
(string zip step)

suffixedclj

(suffixed zip)
(suffixed zip step)

tagclj

(tag zip)
(tag zip step)

tightenclj

(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)"
raw docstring

tighten-leftclj

(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)"
raw docstring

tighten-rightclj

(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)"
raw docstring

token?clj

(token? zip)
(token? zip step)

typeclj

(type zip)
(type zip step)

upclj

(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]]"
raw docstring

update-childrenclj

(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]"
raw docstring

update-step-insideclj

(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]}
raw docstring

update-step-inside-leftclj

(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]}
raw docstring

update-step-leftclj

(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]}
raw docstring

update-step-outsideclj

(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]
raw docstring

update-step-rightclj

(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]}
raw docstring

valueclj

(value zip)
(value zip step)

value-stringclj

(value-string zip)
(value-string zip step)

verifyclj

(verify zip)
(verify zip step)

void?clj

(void? zip)
(void? zip step)

widthclj

(width zip)
(width zip step)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close