Module Vector

module Vector: sig .. end
Dynamic arrays.

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
Signature for vectors.
module type ArrayType = sig .. end
Signature for arrays.
module type DefaultValType = sig .. end
Signature for elements.
module type AnyType = sig .. end
Signature for elements when no default value is necessary.
module type ComparableType = sig .. end
Signature for elements that can be compared.
module OfArrayGap (A : ArrayType)  (E : DefaultValType  with type t = A.elt) : sig .. end
Get a Vector from an Array.
module OfArray (A : ArrayType) : sig .. end
module QueueOfArray (A : ArrayType) : sig .. end
Queue implementation in a vector.
module StackOfArray (A : ArrayType) : sig .. end
Stack implementation in a vector.
module HeapOfArray (A : ArrayType)  (E : ComparableType  with type t = A.elt) : sig .. end
Heap implementation in a vector.
module MakeArray (E : AnyType) : sig .. end
module MakeGap (E : DefaultValType) : OfArrayGap(MakeArray(E))(E)
Vectors with gaps from usual arrays.
module Make (E : AnyType) : OfArray(MakeArray(E))
Vectors from usual arrays.
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