Library
Module
Module type
Parameter
Class
Class type
Iterators for ropes. It is more efficient to use an iterator to perform small steps and get the characters than to use Rope.get
repeatedly.
Mutable iterator on a rope. Iterators are less efficient than Rope.get
on small ropes (of length <= 1024
chars).
make r i0
returns a new iterator for the rope r
. It is initially at position i0
.
val get : t -> char
get itr
returns the character of the rope at the current position. O(1) time. This does not change the current position.
val peek : t -> int -> char
get itr
returns the character of the rope at the current position. O(1) time. This does not change the current position.
peek itr i
returns the character i
of the rope. If i
is close to the current position of the iterator, this will in general be more efficient than get rope i
.
val pos : t -> int
peek itr i
returns the character i
of the rope. If i
is close to the current position of the iterator, this will in general be more efficient than get rope i
.
pos itr
returns the current position. It may not be a valid position of the rope. O(1) time.
val incr : t -> unit
incr itr
moves to the next character. O(1) time.
val decr : t -> unit
incr itr
moves to the next character. O(1) time.
decr itr
moves to the previous character. O(1) time.
val goto : t -> int -> unit
decr itr
moves to the previous character. O(1) time.
goto itr i
move to position i
. O(1) time but the next call to get
may be slower.
val move : t -> int -> unit
goto itr i
move to position i
. O(1) time but the next call to get
may be slower.
mode itr i
move the current position by i
chars (i
may be negative or null). O(1) time but the next call to get
may be slower.