Liking cljdoc? Tell your friends :D

rewrite-clj.zip


->root-stringcljdeprecated

(->root-string zloc)

DEPRECATED. Use root-string instead.

DEPRECATED. Use `root-string` instead.
sourceraw docstring

->stringcljdeprecated

(->string zloc)

DEPRECATED. Use string instead.

DEPRECATED. Use `string` instead.
sourceraw docstring

append-childclj

(append-child zloc item)

Insert item as last child of the current node. Will insert a space if necessary.

Insert item as last child of the current node. Will insert a space if necessary.
sourceraw docstring

append-newlinecljdeprecated

(append-newline zloc & [n])

Append a newline node representing the given number of linebreaks (default: 1).

DEPRECATED: use 'insert-newline-right' instead.

Append a newline node representing the given number of linebreaks (default:
1).

DEPRECATED: use 'insert-newline-right' instead.
sourceraw docstring

append-spacecljdeprecated

(append-space zloc & [n])

Append a whitespace node representing the given number of spaces (default: 1).

DEPRECATED: use 'insert-space-right' instead.

Append a whitespace node representing the given number of spaces (default: 1).

DEPRECATED: use 'insert-space-right' instead.
sourceraw docstring

assocclj

(assoc zloc k v)

Set map/seq element to the given value.

Set map/seq element to the given value.
sourceraw docstring

child-sexprsclj

(child-sexprs zloc)

Get children as s-expressions.

Get children as s-expressions.
sourceraw docstring

downclj

(down zloc)

Move down to next non-whitespace/non-comment location.

Move down to next non-whitespace/non-comment location.
sourceraw docstring

down*clj

(down* G__1187)

Directly call 'rewrite-clj.custom-zipper.core/down' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/down' on the given arguments.
sourceraw docstring

editclj

(edit zloc f & args)

Apply the given function to the s-expression at the given location, using its result to replace the node there. (The result will be coerced to a node if possible.)

Apply the given function to the s-expression at the given
location, using its result to replace the node there. (The
result will be coerced to a node if possible.)
sourceraw docstring

edit*clj

(edit* loc f & args)

Directly call 'rewrite-clj.custom-zipper.core/edit' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/edit' on the given arguments.
sourceraw docstring

edit->cljmacro

(edit-> zloc & body)

Like ->, applying the given function to the current zipper location. The resulting zipper will be located at the same path (i.e. the same number of downwards and right movements from the root) as the original node.

Like `->`, applying the given function to the current zipper location.
The resulting zipper will be located at the same path (i.e. the same
number of downwards and right movements from the root) as the original
node.
sourceraw docstring

edit->>cljmacro

(edit->> zloc & body)

Like ->>, applying the given function to the current zipper location. The resulting zipper will be located at the same path (i.e. the same number of downwards and right movements from the root) as the original node.

Like `->>`, applying the given function to the current zipper location.
The resulting zipper will be located at the same path (i.e. the same
number of downwards and right movements from the root) as the original
node.
sourceraw docstring

edit-nodeclj

(edit-node zloc f)

Apply the given function to the current zipper location. The resulting zipper will be located at the same path (i.e. the same number of downwards and right movements from the root) as the original node.

Apply the given function to the current zipper location. The resulting
zipper will be located at the same path (i.e. the same number of
downwards and right movements from the root) as the original node.
sourceraw docstring

ednclj

(edn node)
(edn node {:keys [track-position?] :as options})

Create zipper over the given Clojure/EDN node and move to the first non-whitespace/non-comment child.

If :track-position? is set, this will create a custom zipper that will return the current row/column using rewrite-clj.zip/position. (Note that this custom zipper will be incompatible with clojure.zip's functions.)

Create zipper over the given Clojure/EDN node and move to the first
non-whitespace/non-comment child.

If `:track-position?` is set, this will create a custom zipper that will
return the current row/column using `rewrite-clj.zip/position`. (Note that
this custom zipper will be incompatible with `clojure.zip`'s functions.)
sourceraw docstring

edn*clj

(edn* node)
(edn* node {:keys [track-position?]})

Create zipper over the given Clojure/EDN node.

If :track-position? is set, this will create a custom zipper that will return the current row/column using rewrite-clj.zip/position. (Note that this custom zipper will be incompatible with clojure.zip's functions.)

Create zipper over the given Clojure/EDN node.

If `:track-position?` is set, this will create a custom zipper that will
return the current row/column using `rewrite-clj.zip/position`. (Note that
this custom zipper will be incompatible with `clojure.zip`'s functions.)
sourceraw docstring

end?clj

(end? zloc)

Check whether the given node is at the end of the depth-first traversal.

Check whether the given node is at the end of the depth-first traversal.
sourceraw docstring

findclj

(find zloc p?)
(find zloc f p?)

Find node satisfying the given predicate by repeatedly applying the given movement function to the initial zipper location.

Find node satisfying the given predicate by repeatedly
applying the given movement function to the initial zipper
location.
sourceraw docstring

find-depth-firstclj

(find-depth-first zloc p?)

Find node satisfying the given predicate by traversing the zipper in a depth-first way.

Find node satisfying the given predicate by traversing
the zipper in a depth-first way.
sourceraw docstring

find-nextclj

(find-next zloc p?)
(find-next zloc f p?)

Find node other than the current zipper location matching the given predicate by applying the given movement function to the initial zipper location.

Find node other than the current zipper location matching
the given predicate by applying the given movement function
to the initial zipper location.
sourceraw docstring

find-next-depth-firstclj

(find-next-depth-first zloc p?)

Find node other than the current zipper location matching the given predicate by traversing the zipper in a depth-first way.

Find node other than the current zipper location matching
the given predicate by traversing the zipper in a
depth-first way.
sourceraw docstring

find-next-tagclj

(find-next-tag zloc t)
(find-next-tag zloc f t)

Find node other than the current zipper location with the given tag by repeatedly applying the given movement function to the initial zipper location.

Find node other than the current zipper location with the
given tag by repeatedly applying the given movement function to
the initial zipper location.
sourceraw docstring

find-next-tokenclj

(find-next-token zloc p?)
(find-next-token zloc f p?)

Find next token node matching the given predicate by applying the given movement function to the initial zipper location, defaulting to right.

Find next token node matching the given predicate by applying the
given movement function to the initial zipper location, defaulting
to `right`.
sourceraw docstring

find-next-valueclj

(find-next-value zloc v)
(find-next-value zloc f v)

Find next token node whose value matches the given one by applying the given movement function to the initial zipper location, defaulting to right.

Find next token node whose value matches the given one by applying the
given movement function to the initial zipper location, defaulting
to `right`.
sourceraw docstring

find-tagclj

(find-tag zloc t)
(find-tag zloc f t)

Find node with the given tag by repeatedly applying the given movement function to the initial zipper location.

Find node with the given tag by repeatedly applying the given
movement function to the initial zipper location.
sourceraw docstring

find-tokenclj

(find-token zloc p?)
(find-token zloc f p?)

Find token node matching the given predicate by applying the given movement function to the initial zipper location, defaulting to right.

Find token node matching the given predicate by applying the
given movement function to the initial zipper location, defaulting
to `right`.
sourceraw docstring

find-valueclj

(find-value zloc v)
(find-value zloc f v)

Find token node whose value matches the given one by applying the given movement function to the initial zipper location, defaulting to right.

Find token node whose value matches the given one by applying the
given movement function to the initial zipper location, defaulting
to `right`.
sourceraw docstring

getclj

(get zloc k)

If a map is given, get element with the given key; if a seq is given, get nth element.

If a map is given, get element with the given key; if a seq is given, get nth element.
sourceraw docstring

insert-childclj

(insert-child zloc item)

Insert item as first child of the current node. Will insert a space if necessary.

Insert item as first child of the current node. Will insert a space if necessary.
sourceraw docstring

insert-leftclj

(insert-left zloc item)

Insert item to the right of the left location. Will insert a space if necessary.

Insert item to the right of the left location. Will insert a space if necessary.
sourceraw docstring

insert-left*clj

(insert-left* G__1226 G__1227)

Directly call 'rewrite-clj.custom-zipper.core/insert-left' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/insert-left' on the given arguments.
sourceraw docstring

insert-rightclj

(insert-right zloc item)

Insert item to the right of the current location. Will insert a space if necessary.

Insert item to the right of the current location. Will insert a space if necessary.
sourceraw docstring

insert-right*clj

(insert-right* G__1230 G__1231)

Directly call 'rewrite-clj.custom-zipper.core/insert-right' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/insert-right' on the given arguments.
sourceraw docstring

leftclj

(left zloc)

Move left to next non-whitespace/non-comment location.

Move left to next non-whitespace/non-comment location.
sourceraw docstring

left*clj

(left* G__1212)

Directly call 'rewrite-clj.custom-zipper.core/left' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/left' on the given arguments.
sourceraw docstring

leftmostclj

(leftmost zloc)

Move to the leftmost non-whitespace/non-comment location.

Move to the leftmost non-whitespace/non-comment location.
sourceraw docstring

leftmost*clj

(leftmost* G__1219)

Directly call 'rewrite-clj.custom-zipper.core/leftmost' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/leftmost' on the given arguments.
sourceraw docstring

leftmost?clj

(leftmost? zloc)

Check if the given location represents the leftmost non-whitespace/ non-comment one.

Check if the given location represents the leftmost non-whitespace/
non-comment one.
sourceraw docstring

lengthclj

(length zloc)

Get length of printable string for the given zipper location.

Get length of printable string for the given zipper location.
sourceraw docstring

linebreak?clj

(linebreak? zloc)
source

list?clj

(list? zloc)
source

mapclj

(map f zloc)

Apply function to all value nodes in the given seq node. Iterates over value nodes of maps but over each element of a seq.

Apply function to all value nodes in the given seq node. Iterates over
value nodes of maps but over each element of a seq.
sourceraw docstring

map-keysclj

(map-keys f zloc)

Apply function to all key nodes of the given map node.

Apply function to all key nodes of the given map node.
sourceraw docstring

map-valsclj

(map-vals f zloc)

Apply function to all value nodes of the given map node.

Apply function to all value nodes of the given map node.
sourceraw docstring

map?clj

(map? zloc)
source

nextclj

(next zloc)

Move to the next non-whitespace/non-comment location in a depth-first manner.

Move to the next non-whitespace/non-comment location in a depth-first manner.
sourceraw docstring

next*clj

(next* G__1244)

Directly call 'rewrite-clj.custom-zipper.core/next' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/next' on the given arguments.
sourceraw docstring

nodeclj

(node G__1171)

Returns the node at loc

Returns the node at loc
sourceraw docstring

of-fileclj

(of-file f)
(of-file f options)

Create zipper from File.

Create zipper from File.
sourceraw docstring

of-stringclj

(of-string s)
(of-string s options)

Create zipper from String.

Create zipper from String.
sourceraw docstring

positionclj

(position loc)

Returns the ones-based [row col] of the start of the current node

Returns the ones-based [row col] of the start of the current node
sourceraw docstring

postwalkclj

(postwalk zloc f)
(postwalk zloc p? f)

Perform a depth-first post-order traversal starting at the given zipper location and apply the given function to each child node. If a predicate p? is given, only apply the function to nodes matching it.

Perform a depth-first post-order traversal starting at the given zipper location
and apply the given function to each child node. If a predicate `p?` is given,
only apply the function to nodes matching it.
sourceraw docstring

prefixclj

(prefix zloc s)
source

prepend-newlinecljdeprecated

(prepend-newline zloc & [n])

Prepend a newline node representing the given number of linebreaks (default: 1).

DEPRECATED: use 'insert-newline-left' instead.

Prepend a newline node representing the given number of linebreaks (default:
1).

DEPRECATED: use 'insert-newline-left' instead.
sourceraw docstring

prepend-spacecljdeprecated

(prepend-space zloc & [n])

Prepend a whitespace node representing the given number of spaces (default: 1).

DEPRECATED: use 'insert-space-left' instead.

Prepend a whitespace node representing the given number of spaces (default: 1).

DEPRECATED: use 'insert-space-left' instead.
sourceraw docstring

prevclj

(prev zloc)

Move to the next non-whitespace/non-comment location in a depth-first manner.

Move to the next non-whitespace/non-comment location in a depth-first manner.
sourceraw docstring

prev*clj

(prev* G__1251)

Directly call 'rewrite-clj.custom-zipper.core/prev' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/prev' on the given arguments.
sourceraw docstring

prewalkclj

(prewalk zloc f)
(prewalk zloc p? f)

Perform a depth-first pre-order traversal starting at the given zipper location and apply the given function to each child node. If a predicate p? is given, only apply the function to nodes matching it.

Perform a depth-first pre-order traversal starting at the given zipper location
and apply the given function to each child node. If a predicate `p?` is given,
only apply the function to nodes matching it.
sourceraw docstring

printclj

(print zloc & [writer])

Print current zipper location.

Print current zipper location.
sourceraw docstring

(print-root zloc & [writer])

Zip up and print root node.

Zip up and print root node.
sourceraw docstring

removeclj

(remove zloc)

Remove value at the given zipper location. Returns the first non-whitespace node that would have preceded it in a depth-first walk. Will remove whitespace appropriately.

[1  2  3]   => [1  3]
[1 2]       => [1]
[1 2]       => [2]
[1]         => []
[  1  ]     => []
[1 [2 3] 4] => [1 [2 3]]
[1 [2 3] 4] => [[2 3] 4]

If a node is located rightmost, both preceding and trailing spaces are removed, otherwise only trailing spaces are touched. This means that a following element (no matter whether on the same line or not) will end up in the same position (line/column) as the removed one, unless a comment lies between the original node and the neighbour.

Remove value at the given zipper location. Returns the first non-whitespace
node that would have preceded it in a depth-first walk. Will remove whitespace
appropriately.

    [1  2  3]   => [1  3]
    [1 2]       => [1]
    [1 2]       => [2]
    [1]         => []
    [  1  ]     => []
    [1 [2 3] 4] => [1 [2 3]]
    [1 [2 3] 4] => [[2 3] 4]

If a node is located rightmost, both preceding and trailing spaces are removed,
otherwise only trailing spaces are touched. This means that a following element
(no matter whether on the same line or not) will end up in the same position
(line/column) as the removed one, _unless_ a comment lies between the original
node and the neighbour.
sourceraw docstring

remove*clj

(remove* G__1258)

Directly call 'rewrite-clj.custom-zipper.core/remove' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/remove' on the given arguments.
sourceraw docstring

replaceclj

(replace zloc value)

Replace the node at the given location with one representing the given value. (The value will be coerced to a node if possible.)

Replace the node at the given location with one representing
the given value. (The value will be coerced to a node if
possible.)
sourceraw docstring

replace*clj

(replace* G__1234 G__1235)

Directly call 'rewrite-clj.custom-zipper.core/replace' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/replace' on the given arguments.
sourceraw docstring

(right zloc)

Move right to next non-whitespace/non-comment location.

Move right to next non-whitespace/non-comment location.
sourceraw docstring

right*clj

(right* G__1202)

Directly call 'rewrite-clj.custom-zipper.core/right' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/right' on the given arguments.
sourceraw docstring

rightmostclj

(rightmost zloc)

Move to the rightmost non-whitespace/non-comment location.

Move to the rightmost non-whitespace/non-comment location.
sourceraw docstring

rightmost*clj

(rightmost* G__1209)

Directly call 'rewrite-clj.custom-zipper.core/rightmost' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/rightmost' on the given arguments.
sourceraw docstring

rightmost?clj

(rightmost? zloc)

Check if the given location represents the leftmost non-whitespace/ non-comment one.

Check if the given location represents the leftmost non-whitespace/
non-comment one.
sourceraw docstring

rootclj

(root G__1199)

zips all the way up and returns the root node, reflecting any changes.

zips all the way up and returns the root node, reflecting any changes.
sourceraw docstring

root-stringclj

(root-string zloc)

Create string representing the zipped-up zipper.

Create string representing the zipped-up zipper.
sourceraw docstring

seq?clj

(seq? zloc)
source

set?clj

(set? zloc)
source

sexprclj

(sexpr zloc)

Get sexpr represented by the given node.

Get sexpr represented by the given node.
sourceraw docstring

skipclj

(skip f p? zloc)

Perform the given movement while the given predicate returns true.

Perform the given movement while the given predicate returns true.
sourceraw docstring

skip-whitespaceclj

(skip-whitespace zloc)
(skip-whitespace f zloc)

Perform the given movement (default: z/right) until a non-whitespace/ non-comment node is encountered.

Perform the given movement (default: `z/right`) until a non-whitespace/
non-comment node is encountered.
sourceraw docstring

skip-whitespace-leftclj

(skip-whitespace-left zloc)

Move left until a non-whitespace/non-comment node is encountered.

Move left until a non-whitespace/non-comment node is encountered.
sourceraw docstring

spliceclj

(splice zloc)

Splice the given node, i.e. merge its children into the current one (akin to Clojure's unquote-splicing macro: ~@...).

  • if the node is not one that can have children, no modification will be performed.
  • if the node has no or only whitespace children, it will be removed.
  • otherwise, splicing will be performed, moving the zipper to the first non-whitespace child afterwards.
Splice the given node, i.e. merge its children into the current one
(akin to Clojure's `unquote-splicing` macro: `~@...`).

- if the node is not one that can have children, no modification will
  be performed.
- if the node has no or only whitespace children, it will be removed.
- otherwise, splicing will be performed, moving the zipper to the first
  non-whitespace child afterwards.
sourceraw docstring

stringclj

(string zloc)

Create string representing the current zipper location.

Create string representing the current zipper location.
sourceraw docstring

subedit->cljmacro

(subedit-> zloc & body)

Like ->, applying modifications to the current sub-tree, zipping up to the current location afterwards.

Like `->`, applying modifications to the current sub-tree, zipping
up to the current location afterwards.
sourceraw docstring

subedit->>cljmacro

(subedit->> zloc & body)

Like ->>, applying modifications to the current sub-tree, zipping up to the current location afterwards.

Like `->>`, applying modifications to the current sub-tree, zipping
up to the current location afterwards.
sourceraw docstring

subedit-nodeclj

(subedit-node zloc f)

Apply the given function to the current sub-tree. The resulting zipper will be located on the root of the modified sub-tree.

Apply the given function to the current sub-tree. The resulting
zipper will be located on the root of the modified sub-tree.
sourceraw docstring

suffixclj

(suffix zloc s)
source

tagclj

(tag zloc)

Get tag of node at the current zipper location.

Get tag of node at the current zipper location.
sourceraw docstring

upclj

(up zloc)

Move up to next non-whitespace/non-comment location.

Move up to next non-whitespace/non-comment location.
sourceraw docstring

up*clj

(up* G__1196)

Directly call 'rewrite-clj.custom-zipper.core/up' on the given arguments.

Directly call 'rewrite-clj.custom-zipper.core/up' on the given arguments.
sourceraw docstring

valuecljdeprecated

(value zloc)

DEPRECATED. Return a tag/s-expression pair for inner nodes, or the s-expression itself for leaves.

DEPRECATED. Return a tag/s-expression pair for inner nodes, or
the s-expression itself for leaves.
sourceraw docstring

vector?clj

(vector? zloc)
source

whitespace-or-comment?clj

(whitespace-or-comment? zloc)
source

whitespace?clj

(whitespace? zloc)
source

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

× close