Module type CCMap.S
include Stdlib.Map.S
val empty : 'a tval is_empty : 'a t -> boolval mem : key -> 'a t -> boolval add : key -> 'a -> 'a t -> 'a tval update : key -> ('a option -> 'a option) -> 'a t -> 'a tval singleton : key -> 'a -> 'a tval remove : key -> 'a t -> 'a tval merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c tval union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a tval compare : ('a -> 'a -> int) -> 'a t -> 'a t -> intval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> boolval iter : (key -> 'a -> unit) -> 'a t -> unitval fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'bval for_all : (key -> 'a -> bool) -> 'a t -> boolval exists : (key -> 'a -> bool) -> 'a t -> boolval filter : (key -> 'a -> bool) -> 'a t -> 'a tval partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a tval cardinal : 'a t -> intval bindings : 'a t -> (key * 'a) listval min_binding : 'a t -> key * 'aval min_binding_opt : 'a t -> (key * 'a) optionval max_binding : 'a t -> key * 'aval max_binding_opt : 'a t -> (key * 'a) optionval choose : 'a t -> key * 'aval choose_opt : 'a t -> (key * 'a) optionval split : key -> 'a t -> 'a t * 'a option * 'a tval find : key -> 'a t -> 'aval find_opt : key -> 'a t -> 'a optionval find_first : (key -> bool) -> 'a t -> key * 'aval find_first_opt : (key -> bool) -> 'a t -> (key * 'a) optionval find_last : (key -> bool) -> 'a t -> key * 'aval find_last_opt : (key -> bool) -> 'a t -> (key * 'a) optionval map : ('a -> 'b) -> 'a t -> 'b tval mapi : (key -> 'a -> 'b) -> 'a t -> 'b tval to_seq : 'a t -> (key * 'a) Stdlib.Seq.tval to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.tval add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a tval of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
val get : key -> 'a t -> 'a optionget k mreturnsSome vif the current binding ofkinmisv, orNoneif the keykis not present. Safe version offind.
val get_or : key -> 'a t -> default:'a -> 'aget_or k m ~defaultreturns the value associated tokif present, and returnsdefaultotherwise (ifkdoesn't belong inm).- since
- 0.16
val update : key -> ('a option -> 'a option) -> 'a t -> 'a tupdate k f mcallsf (Some v)iffind k m = v, otherwise it callsf None. In any case, if the result isNonekis removed fromm, and if the result isSome v'thenadd k v' mis returned.
val choose_opt : 'a t -> (key * 'a) optionchoose_opt mreturns one binding of the given mapm, orNoneifmis empty. Safe version ofchoose.- since
- 1.5
val min_binding_opt : 'a t -> (key * 'a) optionmin_binding_opt mreturns the smallest binding of the given mapm, orNoneifmis empty. Safe version ofmin_binding.- since
- 1.5
val max_binding_opt : 'a t -> (key * 'a) optionmax_binding_opt mreturns the largest binding of the given mapm, orNoneifmis empty. Safe version ofmax_binding.- since
- 1.5
val find_opt : key -> 'a t -> 'a optionfind_opt k mreturnsSome vif the current binding ofkinmisv, orNoneif the keykis not present. Safe version offind.- since
- 1.5
val find_first : (key -> bool) -> 'a t -> key * 'afind_first f mwherefis a monotonically increasing function, returns the binding ofmwith the lowest keyksuch thatf k, or raisesNot_foundif no such key exists. SeeMap.S.find_first.- since
- 1.5
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) optionfind_first_opt f mwherefis a monotonically increasing function, returns an option containing the binding ofmwith the lowest keyksuch thatf k, orNoneif no such key exists. Safe version offind_first.- since
- 1.5
val merge_safe : f:(key -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option) -> 'a t -> 'b t -> 'c tmerge_safe ~f a bmerges the mapsaandbtogether.- since
- 0.17
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> 'a tadd_seq m seqadds the givenSeq.tof bindings to the mapm. Likeadd_list. Renamed fromadd_std_seqsince 3.0.- since
- 3.0
val add_seq_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) Stdlib.Seq.t -> 'a tadd_seq ~f m ladds the given seqlof bindings to the mapm, usingfto combine values that have the same key. If a key occurs several times, all its bindings are combined using the functionf, withf key v1 v2being called withv1occurring later in the seq thanv2.- since
- 3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a tof_seq seqbuilds a map from the givenSeq.tof bindings. Likeof_list. Renamed fromof_std_seqsince 3.0.- since
- 3.0
val of_seq_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) Stdlib.Seq.t -> 'a tof_seq_with ~f lbuilds a map from the given seqlof bindingsk_i -> v_i, added in order usingadd. If a key occurs several times, all its bindings are combined using the functionf, withf key v1 v2being called withv1occurring later in the seq thanv2.- since
- 3.3
val add_iter : 'a t -> (key * 'a) iter -> 'a tadd_iter m iteradds the giveniterof bindings to the mapm. Likeadd_list.- since
- 2.8
val add_iter_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) iter -> 'a tadd_iter ~f m ladds the given iterlof bindings to the mapm, usingfto combine values that have the same key. If a key occurs several times, all its bindings are combined using the functionf, withf key v1 v2being called withv1occurring later in the seq thanv2.- since
- 3.3
val of_iter : (key * 'a) iter -> 'a tof_iter iterbuilds a map from the giveniterof bindings. Likeof_list.- since
- 2.8
val of_iter_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) iter -> 'a tof_iter_with ~f lbuilds a map from the given iterlof bindingsk_i -> v_i, added in order usingadd. If a key occurs several times, all its bindings are combined using the functionf, withf key v1 v2being called withv1occurring later in the iter thanv2.- since
- 3.3
val to_iter : 'a t -> (key * 'a) iterto_iter miterates on the whole mapm, creating aniterof bindings. Liketo_list.- since
- 2.8
val of_list : (key * 'a) list -> 'a tof_list lbuilds a map from the given listlof bindingsk_i -> v_i, added in order usingadd. If a key occurs several times, only its last binding will be present in the result.
val of_list_with : f:(key -> 'a -> 'a -> 'a) -> (key * 'a) list -> 'a tof_list_with ~f lbuilds a map from the given listlof bindingsk_i -> v_i, added in order usingadd. If a key occurs several times, all its bindings are combined using the functionf, withf key v1 v2being called withv1occurring later in the list thanv2.- since
- 3.3
val add_list : 'a t -> (key * 'a) list -> 'a tadd_list m ladds the given listlof bindings to the mapm.- since
- 0.14
val add_list_with : f:(key -> 'a -> 'a -> 'a) -> 'a t -> (key * 'a) list -> 'a tadd_list ~f m ladds the given listlof bindings to the mapm, usingfto combine values that have the same key. If a key occurs several times, all its bindings are combined using the functionf, withf key v1 v2being called withv1occurring later in the seq thanv2.- since
- 3.3
val values : 'a t -> 'a itervalues miterates on the values ofmonly, creating aniterof values.- since
- 0.15