Liking cljdoc? Tell your friends :D

rewrite-clj.zip


->root-stringcljdeprecated

(->root-string zloc)

DEPRECATED. Use root-string instead.

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

->stringcljdeprecated

(->string zloc)

DEPRECATED. Use string instead.

DEPRECATED. Use `string` instead.
raw 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.
raw 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.
raw 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.
raw docstring

assocclj

(assoc zloc k v)

Set map/seq element to the given value.

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

child-sexprsclj

(child-sexprs zloc)

Get children as s-expressions.

Get children as s-expressions.
raw docstring

downclj

(down zloc)

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

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

down*clj

(down* G__2841)

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

Directly call 'rewrite-clj.custom-zipper.core/down' on the given arguments.
raw 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.)
raw 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.
raw 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.
raw 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.
raw 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.
raw 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.)
raw 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.)
raw 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.
raw 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.
raw 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.
raw 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.
raw 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.
raw 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.
raw 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`.
raw 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`.
raw 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.
raw 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`.
raw 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`.
raw 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.
raw 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.
raw 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.
raw docstring

insert-left*clj

(insert-left* G__2880 G__2881)

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

insert-right*clj

(insert-right* G__2884 G__2885)

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

leftclj

(left zloc)

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

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

left*clj

(left* G__2866)

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

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

leftmostclj

(leftmost zloc)

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

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

leftmost*clj

(leftmost* G__2873)

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

Directly call 'rewrite-clj.custom-zipper.core/leftmost' on the given arguments.
raw 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.
raw docstring

lengthclj

(length zloc)

Get length of printable string for the given zipper location.

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

linebreak?clj

(linebreak? zloc)

list?clj

(list? zloc)

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

map?clj

(map? zloc)

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

next*clj

(next* G__2898)

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

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

nodeclj

(node G__2825)

Returns the node at loc

Returns the node at loc
raw docstring

of-fileclj

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

Create zipper from File.

Create zipper from File.
raw docstring

of-stringclj

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

Create zipper from String.

Create zipper from String.
raw 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
raw 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.
raw docstring

prefixclj

(prefix zloc s)

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

prev*clj

(prev* G__2905)

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

Directly call 'rewrite-clj.custom-zipper.core/prev' on the given arguments.
raw 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.
raw docstring

prewalk*clj

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

Like #'prewalk, but does not skip whitespace or comments.

Like `#'prewalk`, but does not skip whitespace or comments.
raw docstring

printclj

(print zloc & [writer])

Print current zipper location.

Print current zipper location.
raw docstring

(print-root zloc & [writer])

Zip up and print root node.

Zip up and print root node.
raw 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.
raw docstring

remove*clj

(remove* G__2912)

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

Directly call 'rewrite-clj.custom-zipper.core/remove' on the given arguments.
raw 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.)
raw docstring

replace*clj

(replace* G__2888 G__2889)

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

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

(right zloc)

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

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

right*clj

(right* G__2856)

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

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

rightmostclj

(rightmost zloc)

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

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

rightmost*clj

(rightmost* G__2863)

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

Directly call 'rewrite-clj.custom-zipper.core/rightmost' on the given arguments.
raw 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.
raw docstring

rootclj

(root G__2853)

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

root-stringclj

(root-string zloc)

Create string representing the zipped-up zipper.

Create string representing the zipped-up zipper.
raw docstring

seq?clj

(seq? zloc)

set?clj

(set? zloc)

sexprclj

(sexpr zloc)

Get sexpr represented by the given node.

Get sexpr represented by the given node.
raw 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.
raw 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.
raw 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.
raw 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.
raw docstring

stringclj

(string zloc)

Create string representing the current zipper location.

Create string representing the current zipper location.
raw 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.
raw 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.
raw 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.
raw docstring

suffixclj

(suffix zloc s)

tagclj

(tag zloc)

Get tag of node at the current zipper location.

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

upclj

(up zloc)

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

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

up*clj

(up* G__2850)

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

Directly call 'rewrite-clj.custom-zipper.core/up' on the given arguments.
raw 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.
raw docstring

vector?clj

(vector? zloc)

whitespace-or-comment?clj

(whitespace-or-comment? zloc)

whitespace?clj

(whitespace? zloc)

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

× close