Functor Store_impl.Make

module Make: 
functor (Ix : Store_intf.INDEX) -> Store_intf.STORE
Parameters:
Ix : Store_intf.INDEX

module Ix: Store_intf.INDEX 
Index module used to index elements in the store
type +'a t 
Type of stores
val empty : 'a t
The empty store
val is_empty : 'a t -> bool
is_empty s
Returns true if s is empty, false otherwise.
val cardinal : 'a t -> int
cardinal s
Returns the number of elements in s.
val next_ix : 'a t -> Ix.t
next_ix s
Returns the next index the store s will use to index a new element.
val singleton : 'a -> Ix.t * 'a t
singleton el
Returns the tuple (ix, store), where ix is the index under which the only element el was stored, and store is the store containing el.
val add : 'a -> 'a t -> Ix.t * 'a t
add el s
Returns the tuple (new_ix, new_store), where new_ix is the index under which the new element el was stored, and new_store is the new store containing el.
val find : Ix.t -> 'a t -> 'a
find ix s
Raises Not_found if index ix not bound.
Returns the element stored under index ix.
val update : Ix.t -> 'a -> 'a t -> 'a t
update ix el s rebinds index ix in store s to point to el, and returns the resulting store. The previous binding disappears. New indices resulting from further adds are guaranteed to have higher indices.
Raises Not_found if index ix not bound.
val remove : Ix.t -> 'a t -> 'a t
remove ix s removes the binding of index ix of store s, and returns the resulting store.
val iter : ('a -> unit) -> 'a t -> unit
iter f s applies f to all stored elements in store s. The order in which elements are passed to f is unspecified.
val iteri : (Ix.t -> 'a -> unit) -> 'a t -> unit
iter f s applies f to all indexes and their related elements in store s. The order in which elements are passed to f is unspecified.
val map : ('a -> 'b) -> 'a t -> 'b t
map f s
Returns a store with all elements in s mapped from their original value to the codomain of f. Only the elements are passed to f. The order in which elements are passed to f is unspecified.
val mapi : (Ix.t -> 'a -> 'b) -> 'a t -> 'b t
mapi f s same as map, but function f also receives the index associated with the elements.
val fold : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b
fold f s a computes (f eN ... (f e1 a) ...), where e1 ... eN are the elements of all bindings in store s. The order in which the bindings are presented to f is unspecified.
val foldi : (Ix.t -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
foldi f s a same as fold, but function f also receives the index associated with the elements.
val to_list : 'a t -> (Ix.t * 'a) list
to_list s converts s to an association list of indices and elements.
val choose : 'a t -> Ix.t * 'a
choose s
Raises Not_found if s is empty.
Returns a tuple (ix, x), where ix is the index of some unspecified value x in store s.
val filter : (Ix.t -> 'a -> bool) -> 'a t -> 'a t
filter p s
Returns the store of all elements in s that satisfy p.
val partition : (Ix.t -> 'a -> bool) ->
'a t -> 'a t * 'a t
partition p s
Returns a pair of stores (s1, s2), where s1 is the store of all the elements of s that satisfy the predicate p, and s2 is the store of all the elements of s that do not satisfy p.
val eq_classes : ('a -> 'a -> bool) ->
'a t -> ('a * 'a t) list
eq_classes eq s
Returns a list of tuples (el, ec), where el is the only kind of element as identified by the equivalence relation eq stored in the equivalence class (store) ec under each index. Every such equivalence class is unique and maximal with respect to s, and the original indices of the elements are preserved in each class.
val get_ix_map : 'a t -> 'a Ix.Map.t
get_ix_map s
Returns a map of all indices mapped to their respective elements in store s.