Module Pomap.Store_impl.IntStore

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

val cardinal : 'a t ‑> int

cardinal s

val next_ix : 'a t ‑> Ix.t

next_ix s

val singleton : 'a ‑> Ix.t * 'a t

singleton el

val add : 'a ‑> 'a t ‑> Ix.t * 'a t

add el s

val find : Ix.t ‑> 'a t ‑> 'a

find ix s

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.

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

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

val filter : (Ix.t ‑> 'a ‑> bool) ‑> 'a t ‑> 'a t

filter p s

val partition : (Ix.t ‑> 'a ‑> bool) ‑> 'a t ‑> 'a t * 'a t

partition p s

val eq_classes : ('a ‑> 'a ‑> bool) ‑> 'a t ‑> ('a * 'a t) list

eq_classes eq s

val get_ix_map : 'a t ‑> 'a Ix.Map.t

get_ix_map s