module FingerTree: BatFingerTree
type 'a
monoid = {
|
zero : |
(* | The neutral element of the monoid. | *) |
|
combine : |
(* | combine should be associative, and have zero as neutral element. | *) |
exception Empty
module type S =sig
..end
module Generic:sig
..end
type 'a
t
include BatFingerTree.S
val size : 'a t -> int
size t
returns the number of elements in the sequence.
Unlike the generic size
on finger trees, this one has complexity O(1).
val split_at : 'a t -> int -> 'a t * 'a t
split_at
is equivalent to List.split_at
.Invalid_argument
when the index is out of bounds.
O(log(n)).
val get : 'a t -> int -> 'a
get t i
returns the i
-th element of t
.Invalid_argument
when the index is out of bounds.
O(log(n)).
val set : 'a t -> int -> 'a -> 'a t
set t i v
returns t
where the i
-th element is now v
.Invalid_argument
when the index is out of bounds.
O(log(n)).
val update : 'a t -> int -> ('a -> 'a) -> 'a t
update t i f
returns t
where the i
-th element is now f (get i t)
.Invalid_argument
when the index is out of bounds.
O(log(n)).