package containers

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Map specialized for Int keys

status: unstable

  • 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 -> _ t -> bool
val find : int -> 'a t -> 'a option
val find_exn : int -> 'a t -> 'a

Same as 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 update : int -> ('a option -> 'a option) -> 'a t -> 'a t
val cardinal : _ t -> int
val iter : (int -> 'a -> unit) -> 'a t -> unit
val fold : (int -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val choose : 'a t -> (int * 'a) option
val choose_exn : 'a t -> int * 'a
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
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 : _ t -> int sequence
val values : 'a t -> 'a sequence

Helpers

val highest_bit : int -> int
type 'a tree = unit -> [ `Nil | `Node of 'a * 'a tree list ]
val as_tree : 'a t -> [ `Node of int * int | `Leaf of int * 'a ] tree
OCaml

Innovation. Community. Security.