Up

Module Bounded_int_table = Core_kernel.Bounded_int_table

Signature

type ('key, 'data) t
val sexp_of_t : ('key -> Sexplib.Sexp.t) -> ('data -> Sexplib.Sexp.t) -> ('key, 'data) t -> Sexplib.Sexp.t
type ('a, 'b) table = ('a, 'b) t
include Core_kernel.Invariant.S2 with type ('a, 'b) t := ('a, 'b) t
type ('a, 'b) t
val invariant : 'a Invariant_intf.inv -> 'b Invariant_intf.inv -> ('a, 'b) t Invariant_intf.inv
include Core_kernel.Equal.S2 with type ('a, 'b) t := ('a, 'b) t
type ('a, 'b) t
val equal : 'a Equal.equal -> 'b Equal.equal -> ('a, 'b) t Equal.equal
val create : ?sexp_of_key:('key -> Core_kernel.Std_internal.Sexp.t) -> num_keys:int -> key_to_int:('key -> int) -> unit -> ('key, 'data) t

create ~num_keys ~key_to_int returns a table where the keys can map to 0 .. num_keys-1, according to key_to_int. It is an error if num_keys < 0.

sexp_of_key, if supplied, will be used to display keys in error messages.

val keys : ('key, _) t -> 'key list

Standard hashtbl functions.

val data : (_, 'data) t -> 'data list
val find : ('key, 'data) t -> 'key -> 'data option
val find_exn : ('key, 'data) t -> 'key -> 'data
val find_or_add : ('key, 'data) t -> 'key -> default:(unit -> 'data) -> 'data
val fold : ('key, 'data) t -> init:'accum -> f:(key:'key -> data:'data -> 'accum -> 'accum) -> 'accum
val iter : ('key, 'data) t -> f:(key:'key -> data:'data -> unit) -> unit
val iteri : ('key, 'data) t -> f:(key:'key -> data:'data -> unit) -> unit
val iter_vals : (_, 'data) t -> f:('data -> unit) -> unit
val filter_mapi : ('key, 'data1) t -> f:(key:'key -> data:'data1 -> 'data2 option) -> ('key, 'data2) t
val filter_map : ('key, 'data1) t -> f:('data1 -> 'data2 option) -> ('key, 'data2) t
val mapi : ('key, 'data1) t -> f:(key:'key -> data:'data1 -> 'data2) -> ('key, 'data2) t
val map : ('key, 'data1) t -> f:('data1 -> 'data2) -> ('key, 'data2) t
val for_alli : ('key, 'data) t -> f:(key:'key -> data:'data -> bool) -> bool
val existsi : ('key, 'data) t -> f:(key:'key -> data:'data -> bool) -> bool
val for_all : (_, 'data) t -> f:('data -> bool) -> bool
val exists : (_, 'data) t -> f:('data -> bool) -> bool
val length : (_, _) t -> int
val mem : ('key, _) t -> 'key -> bool
val remove : ('key, _) t -> 'key -> unit
val set : ('a, 'b) t -> key:'a -> data:'b -> unit
val add : ('a, 'b) t -> key:'a -> data:'b -> [
| `Ok
| `Duplicate of 'b
]
val add_exn : ('a, 'b) t -> key:'a -> data:'b -> unit
val to_alist : ('key, 'data) t -> ('key * 'data) list
val clear : (_, _) t -> unit
module With_key (Key : sig .. end) : sig .. end

set debug := true to turn on debugging, including potentially slow invariant checking.