jon.recoil.org

Module C3.Map

include Flambda2_algorithms.Container_types_intf.Map with type key = C3.t with module Set = C3.Set
type key = C3.t
module Set = C3.Set
type !+'a t
val empty : 'a C3.Map.t
val is_empty : 'a C3.Map.t -> bool
val mem : C3.Map.key -> 'a C3.Map.t -> bool
val add : C3.Map.key -> 'a -> 'a C3.Map.t -> 'a C3.Map.t
val update : C3.Map.key -> ('a option -> 'a option) -> 'a C3.Map.t -> 'a C3.Map.t
val singleton : C3.Map.key -> 'a -> 'a C3.Map.t
val remove : C3.Map.key -> 'a C3.Map.t -> 'a C3.Map.t
val merge : (C3.Map.key -> 'a option -> 'b option -> 'c option) -> 'a C3.Map.t -> 'b C3.Map.t -> 'c C3.Map.t
val union : (C3.Map.key -> 'a -> 'a -> 'a option) -> 'a C3.Map.t -> 'a C3.Map.t -> 'a C3.Map.t
val union_sharing : (C3.Map.key -> 'a -> 'a -> 'a option) -> 'a C3.Map.t -> 'a C3.Map.t -> 'a C3.Map.t

union_sharing f m1 m2 is a version of union f m1 m2 that maximizes sharing of the result with m1.

val union_shared : (C3.Map.key -> 'a -> 'a -> 'a option) -> 'a C3.Map.t -> 'a C3.Map.t -> 'a C3.Map.t

union_shared f m1 m2 is a version of union_sharing f m1 m2 that also exploits sharing of m1 and m2 to avoid calling f when possible, assuming that f x x = Some x for all xs.

val update_many : (C3.Map.key -> 'a option -> 'b -> 'a option) -> 'a C3.Map.t -> 'b C3.Map.t -> 'a C3.Map.t
val compare : ('a -> 'a -> int) -> 'a C3.Map.t -> 'a C3.Map.t -> int
val equal : ('a -> 'a -> bool) -> 'a C3.Map.t -> 'a C3.Map.t -> bool
val iter : (C3.Map.key -> 'a -> unit) -> 'a C3.Map.t -> unit
val fold : (C3.Map.key -> 'a -> 'b -> 'b) -> 'a C3.Map.t -> 'b -> 'b
val for_all : (C3.Map.key -> 'a -> bool) -> 'a C3.Map.t -> bool
val exists : (C3.Map.key -> 'a -> bool) -> 'a C3.Map.t -> bool
val filter : (C3.Map.key -> 'a -> bool) -> 'a C3.Map.t -> 'a C3.Map.t
val filter_map : (C3.Map.key -> 'a -> 'b option) -> 'a C3.Map.t -> 'b C3.Map.t
val filter_map_sharing : (C3.Map.key -> 'a -> 'a option) -> 'a C3.Map.t -> 'a C3.Map.t
val partition : (C3.Map.key -> 'a -> bool) -> 'a C3.Map.t -> 'a C3.Map.t * 'a C3.Map.t
val cardinal : 'a C3.Map.t -> int
val bindings : 'a C3.Map.t -> (C3.Map.key * 'a) list
val min_binding : 'a C3.Map.t -> C3.Map.key * 'a
val min_binding_opt : 'a C3.Map.t -> (C3.Map.key * 'a) option
val max_binding : 'a C3.Map.t -> C3.Map.key * 'a
val max_binding_opt : 'a C3.Map.t -> (C3.Map.key * 'a) option
val choose : 'a C3.Map.t -> C3.Map.key * 'a
val choose_opt : 'a C3.Map.t -> (C3.Map.key * 'a) option
val split : C3.Map.key -> 'a C3.Map.t -> 'a C3.Map.t * 'a option * 'a C3.Map.t
val find : C3.Map.key -> 'a C3.Map.t -> 'a
val find_opt : C3.Map.key -> 'a C3.Map.t -> 'a option
val map : ('a -> 'b) -> 'a C3.Map.t -> 'b C3.Map.t
val mapi : (C3.Map.key -> 'a -> 'b) -> 'a C3.Map.t -> 'b C3.Map.t
val to_seq : 'a C3.Map.t -> (C3.Map.key * 'a) Stdlib.Seq.t
val print_debug : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a C3.Map.t -> unit
val of_list : (C3.Map.key * 'a) list -> 'a C3.Map.t
val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a C3.Map.t -> 'a C3.Map.t -> 'a C3.Map.t
val map_keys : (C3.Map.key -> C3.Map.key) -> 'a C3.Map.t -> 'a C3.Map.t
val keys : 'a C3.Map.t -> Set.t
val data : 'a C3.Map.t -> 'a list
val of_set : (C3.Map.key -> 'a) -> Set.t -> 'a C3.Map.t
val print : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a C3.Map.t -> unit
val diff_domains : 'a C3.Map.t -> 'b C3.Map.t -> 'a C3.Map.t
val inter : (C3.Map.key -> 'a -> 'b -> 'c) -> 'a C3.Map.t -> 'b C3.Map.t -> 'c C3.Map.t
val diff : (C3.Map.key -> 'a -> 'b -> 'a option) -> 'a C3.Map.t -> 'b C3.Map.t -> 'a C3.Map.t

diff f m1 m2 computes a map whose keys are a subset of the keys of m1. When a binding is defined in both m1 and m2, the function f is used to combine them. Bindings that are only present in m1 are preserved. This is a special case of merge: diff f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None _ = None
  • f' _key (Some v) None = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
val diff_sharing : (C3.Map.key -> 'a -> 'b -> 'a option) -> 'a C3.Map.t -> 'b C3.Map.t -> 'a C3.Map.t

diff_sharing f m1 m2 is a version of diff f m1 m2 that maximizes sharing of the result with m1.

val diff_shared : (C3.Map.key -> 'a -> 'a -> 'a option) -> 'a C3.Map.t -> 'a C3.Map.t -> 'a C3.Map.t

diff_shared f m1 m2 is a version of diff_sharing f m1 m2 that further exploits sharing of m1 and m2 to avoid calling f when possible, assuming that f x x always returns None.

val inter_domain_is_non_empty : 'a C3.Map.t -> 'a C3.Map.t -> bool
val get_singleton : 'a C3.Map.t -> (C3.Map.key * 'a) option
val replace : C3.Map.key -> ('a -> 'a) -> 'a C3.Map.t -> 'a C3.Map.t
val map_sharing : ('a -> 'a) -> 'a C3.Map.t -> 'a C3.Map.t
type 'a iterator

An 'a iterator iterates over the values in a 'a t map in increasing order.

val iterator : 'a C3.Map.t -> 'a C3.Map.iterator

iterator t returns an iterator for all the bindings in t, initially positioned on min_binding t.

val current : 'a C3.Map.iterator -> (C3.Map.key * 'a) option

current iterator returns the key-value pair at the current position, or None if the iterator is exhausted.

val advance : 'a C3.Map.iterator -> 'a C3.Map.iterator

advance iterator position the iterator on the next key.

seek iterator key positions the iterator on the next key higher or equal to the provided key.

Note: does nothing if key is less than or equal to the current key.