Module type Prime_map.S
include Stdlib.Map.S
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val split : key -> 'a t -> 'a t * 'a option * 'a t
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val pop : key -> 'a t -> ('a * 'a t) option
pop k m
returnsSome (find k m, remove k m)
ifk
is bound inm
, otherwiseNone
.
val search : (key -> 'a -> 'b option) -> 'a t -> 'b option
search f m
returns the first non-None
result off k v
wherek, v
runs over the bindings ofm
if it exists, otherwiseNone
.
val fold2t : (key -> 'a -> 'b -> 'c -> 'c) -> 'a t -> 'b t -> 'c -> 'c
fold2t f m0 m1
returns the compositionf kₙ vₙ wₙ ∘ ⋯ ∘ f k₁ v₁ w₁
wherek₁, …, kₙ
are the coinciding indices ofm0
andm1
, andv₁, …, vₙ
andw₁, …, wₙ
are the correspoding values fromm0
andm1
, respectively.
val map2t : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
map2t f m0 m1
returns a map which contains a mapping fromk
tof x0 x1
for eachk
,x0
, andx1
such thatm0
mapsk
tox0
andm1
mapsk
tox1
.
val mapi2t : (key -> 'a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
mapi2t f m0 m1
returns a map which contains a mapping fromk
tof k x0 x1
for eachk
,x0
, andx1
such thatm0
mapsk
tox0
andm1
mapsk
tox1
.
val left_union : 'a t -> 'a t -> 'a t
left_union m0 m1
is the map whose domain is the union of the domains ofm0
andm1
and whose values agree withm0
where present andm1
elsewhere.
val split_union : (key -> 'a -> 'b -> 'c) -> 'a t -> 'b t -> 'a t * 'b t * 'c t
split_union mA mB
is a triple(mA', mB', mC')
wheremA'
andmB'
are the respective bindings ofmA
andmB
which have disjoint keys, andmC'
has a binding(k, f k a b)
for each pair of bindings(k, a)
ofmA
and(k, b)
ofmB
sharingk
.