module Vector:sig
..end
Make(E)
provides basic vectors from classical arrays. New elements can
only be inserted at the end of the vector.
MakeGap(E)
provides vectors with gaps. Module E
for elements must
provide a default value. get v i
is allowed for all i >= 0
, the
default value is returned if the position i
was not set before.
set v i e
is allowed for all i >= 0
, memory is allocated for all
positions 0..i
at least.
The length of a vector v
is defined as the length of the smallest prefix
containing all values explicitly set so far. (Equivalently, length =
index_max + 1
where index_max
is the highest index that was set so far.)
Functors ...OfArray(A)(E)
allow to build vectors from any module A
providing arrays of E.t
(Bigarray
for example).
module type S =sig
..end
module type ArrayType =sig
..end
module type DefaultValType =sig
..end
module type AnyType =sig
..end
module type ComparableType =sig
..end
module OfArrayGap(
A
:
ArrayType
)
(
E
:
DefaultValType
with type t = A.elt
)
:sig
..end
module OfArray(
A
:
ArrayType
)
:sig
..end
module QueueOfArray(
A
:
ArrayType
)
:sig
..end
module StackOfArray(
A
:
ArrayType
)
:sig
..end
module HeapOfArray(
A
:
ArrayType
)
(
E
:
ComparableType
with type t = A.elt
)
:sig
..end
module MakeArray(
E
:
AnyType
)
:sig
..end
module MakeGap(
E
:
DefaultValType
)
:OfArrayGap
(
MakeArray
(
E
)
)
(
E
)
module Make(
E
:
AnyType
)
:OfArray
(
MakeArray
(
E
)
)
module Queue(
E
:
AnyType
)
:QueueOfArray
(
MakeArray
(
E
)
)
module Stack(
E
:
AnyType
)
:StackOfArray
(
MakeArray
(
E
)
)
module Heap(
E
:
ComparableType
)
:HeapOfArray
(
MakeArray
(
E
)
)
(
E
)
module Util(
A
:
ArrayType
)
:sig
..end
val unit : unit -> unit