package zed
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c387b0496c34c7eb680999e751525992e3e636a803297480ef004498887625fd
md5=51e8676ba972e5ad727633c161e404b1
doc/zed/Zed_rope/index.html
Module Zed_rope
Source
Unicode ropes
Type of unicode ropes.
Exception raised when trying to access a character which is outside the bounds of a rope.
Construction
make length char
creates a rope of length length
containing only char
.
singleton ch
creates a rope of length 1 containing only ch
.
Informations
Random access
get rope idx
returns the glyph at index idx
in rope
.
get_raw rope idx
returns the character at raw index idx
in rope
.
Rope manipulation
concat sep l
concatenates all strings of l
separating them by sep
.
sub rope ofs len
Returns the sub-rope of rope
starting at ofs
and of length len
.
break rope pos
returns the sub-ropes before and after pos
in rope
. It is more efficient than creating two sub-ropes with sub
.
insert rope pos sub
inserts sub
in rope
at position pos
.
insert rope pos char
inserts char
in rope
at position pos
. If char
is a combing mark, it's merged to the character at position pos-1
remove rope pos len
removes the len
characters at position pos
in rope
replace rope pos len repl
replaces the len
characters at position pos
in rope
by repl
.
lchop rope
returns rope
without is first character. Returns empty
if rope
is empty.
rchop rope
returns rope
without is last character. Returns empty
if rope
is empty.
Iteration, folding and mapping
iter f rope
applies f
on all characters of rope
starting from the left.
rev_iter f rope
applies f
an all characters of rope
starting from the right.
fold f rope acc
applies f
on all characters of rope
starting from the left, accumulating a value.
rev_fold f rope acc
applies f
on all characters of rope
starting from the right, accumulating a value.
map f rope
maps all characters of rope
with f
.
rev_map f str
maps all characters of rope
with f
in reverse order.
Iteration and folding on leafs
Note: for all of the following functions, the leaves must absolutely not be modified.
iter_leaf f rope
applies f
on all leaves of rope
starting from the left.
iter_leaf f rope
applies f
on all leaves of rope
starting from the right.
fold f rope acc
applies f
on all leaves of rope
starting from the left, accumulating a value.
rev_fold f rope acc
applies f
on all leaves of rope
starting from the right, accumulating a value.