Module CCIntMap
Map specialized for Int keys
status: stable
- since
- 0.10
val singleton : int -> 'a -> 'a tval doubleton : int -> 'a -> int -> 'a -> 'a tval mem : int -> _ t -> boolval find : int -> 'a t -> 'a optionval find_exn : int -> 'a t -> 'aSame as
findbut unsafe.- raises Not_found
if key is not present.
val add : int -> 'a -> 'a t -> 'a tval remove : int -> 'a t -> 'a tval equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> boolequal ~eq a bchecks whetheraandbhave the same set of pairs (key, value), comparing values witheq.- since
- 0.13
val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> intTotal order between maps; the precise order is unspecified.
- since
- 0.13
val update : int -> ('a option -> 'a option) -> 'a t -> 'a tval filter : (int -> 'a -> bool) -> 'a t -> 'a tFilter values using the given predicate
- since
- 2.3
val filter_map : (int -> 'a -> 'b option) -> 'a t -> 'b tFilter-map values using the given function
- since
- 2.3
val cardinal : _ t -> intNumber of bindings in the map. Linear time.
val iter : (int -> 'a -> unit) -> 'a t -> unitval fold : (int -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'bval mapi : (int -> 'a -> 'b) -> 'a t -> 'b t- since
- 0.17
val choose : 'a t -> (int * 'a) optionval choose_exn : 'a t -> int * 'a- raises Not_found
if not pair was found.
val union : (int -> 'a -> 'a -> 'a) -> 'a t -> 'a t -> 'a tval inter : (int -> 'a -> 'a -> 'a) -> 'a t -> 'a t -> 'a tval merge : f:(int -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option) -> 'a t -> 'b t -> 'c tmerge ~f m1 m2mergesm1andm2together, callingfonce on every key that occurs in at least one ofm1andm2. iff k binding = Some cthenk -> cis part of the result, elsekis not part of the result.- since
- 2.3
Whole-collection operations
type 'a sequence= ('a -> unit) -> unittype 'a gen= unit -> 'a optiontype 'a klist= unit -> [ `Nil | `Cons of 'a * 'a klist ]
val add_list : 'a t -> (int * 'a) list -> 'a tval of_list : (int * 'a) list -> 'a tval to_list : 'a t -> (int * 'a) listval add_seq : 'a t -> (int * 'a) sequence -> 'a tval of_seq : (int * 'a) sequence -> 'a tval to_seq : 'a t -> (int * 'a) sequenceval keys : _ t -> int sequenceval values : 'a t -> 'a sequenceval add_gen : 'a t -> (int * 'a) gen -> 'a t- since
- 0.13
type 'a tree= unit -> [ `Nil | `Node of 'a * 'a tree list ]