Module CCIntMap

module CCIntMap: sig .. end

Map specialized for Int keys

status: stable
Since 0.10


type 'a t 
val empty : 'a t
val singleton : int -> 'a -> 'a t
val doubleton : int -> 'a -> int -> 'a -> 'a t
val mem : int -> 'a t -> bool
val find : int -> 'a t -> 'a option
val find_exn : int -> 'a t -> 'a
Same as CCIntMap.find but unsafe
Raises Not_found if key not present
val add : int -> 'a -> 'a t -> 'a t
val remove : int -> 'a t -> 'a t
val equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool
equal ~eq a b checks whether a and b have the same set of pairs (key, value), comparing values with eq
Since 0.13
val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int
Total order between maps; the precise order is unspecified .
Since 0.13
val update : int -> ('a option -> 'a option) -> 'a t -> 'a t
val cardinal : 'a t -> int
Number of bindings in the map. Linear time
val iter : (int -> 'a -> unit) -> 'a t -> unit
val fold : (int -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
Since 0.17
val map : ('a -> 'b) -> 'a t -> 'b t
Since 0.17
val choose : 'a t -> (int * 'a) option
val 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 t
val inter : (int -> 'a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t

Whole-collection operations


type 'a sequence = ('a -> unit) -> unit 
type 'a gen = unit -> 'a option 
type 'a klist = unit -> [ `Cons of 'a * 'a klist | `Nil ] 
val add_list : 'a t -> (int * 'a) list -> 'a t
val of_list : (int * 'a) list -> 'a t
val to_list : 'a t -> (int * 'a) list
val add_seq : 'a t -> (int * 'a) sequence -> 'a t
val of_seq : (int * 'a) sequence -> 'a t
val to_seq : 'a t -> (int * 'a) sequence
val keys : 'a t -> int sequence
val values : 'a t -> 'a sequence
val add_gen : 'a t -> (int * 'a) gen -> 'a t
Since 0.13
val of_gen : (int * 'a) gen -> 'a t
Since 0.13
val to_gen : 'a t -> (int * 'a) gen
Since 0.13
val add_klist : 'a t -> (int * 'a) klist -> 'a t
Since 0.13
val of_klist : (int * 'a) klist -> 'a t
Since 0.13
val to_klist : 'a t -> (int * 'a) klist
Since 0.13
type 'a tree = unit -> [ `Nil | `Node of 'a * 'a tree list ] 
val as_tree : 'a t -> [ `Leaf of int * 'a | `Node of int * int ] tree

IO


type 'a printer = Format.formatter -> 'a -> unit 
val print : 'a printer -> 'a t printer
Since 0.13

Helpers