Module Prelude.Hashtbl

Extension of Hashtbl with functions to serialize to and deserialize from yojson, along with some other helpers

A Hashtbl is a represented as a list of key-value pairs, where a key-value pair is list of two elements

Extension of Hashtbl with functions to serialize to and deserialize from yojson, along with some other helpers

A Hashtbl is a represented as a list of key-value pairs, where a key-value pair is list of two elements

Extension of Hashtbl with functions to serialize to and deserialize from yojson, along with some other helpers

A Hashtbl is a represented as a list of key-value pairs, where a key-value pair is list of two elements

include module type of struct include Stdlib.Hashtbl end
type (!'a, !'b) t = ('a, 'b) Stdlib__Hashtbl.t
val create : ?random:bool -> int -> ('a, 'b) t
val clear : ('a, 'b) t -> unit
val reset : ('a, 'b) t -> unit
val copy : ('a, 'b) t -> ('a, 'b) t
val add : ('a, 'b) t -> 'a -> 'b -> unit
val find : ('a, 'b) t -> 'a -> 'b
val find_opt : ('a, 'b) t -> 'a -> 'b option
val find_all : ('a, 'b) t -> 'a -> 'b list
val mem : ('a, 'b) t -> 'a -> bool
val remove : ('a, 'b) t -> 'a -> unit
val replace : ('a, 'b) t -> 'a -> 'b -> unit
val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit
val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit
val fold : ('a -> 'b -> 'acc -> 'acc) -> ('a, 'b) t -> 'acc -> 'acc
val length : ('a, 'b) t -> int
val randomize : unit -> unit
val is_randomized : unit -> bool
val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t
type statistics = Stdlib__Hashtbl.statistics = {
  1. num_bindings : int;
  2. num_buckets : int;
  3. max_bucket_length : int;
  4. bucket_histogram : int array;
}
val stats : ('a, 'b) t -> statistics
val to_seq : ('a, 'b) t -> ('a * 'b) Stdlib.Seq.t
val to_seq_keys : ('a, 'b) t -> 'a Stdlib.Seq.t
val to_seq_values : ('a, 'b) t -> 'b Stdlib.Seq.t
val add_seq : ('a, 'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val replace_seq : ('a, 'b) t -> ('a * 'b) Stdlib.Seq.t -> unit
val of_seq : ('a * 'b) Stdlib.Seq.t -> ('a, 'b) t
module type HashedType = Utils.Prelude.Hashtbl.HashedType
module type S = Utils.Prelude.Hashtbl.S
module type SeededHashedType = Utils.Prelude.Hashtbl.SeededHashedType
module type SeededS = Utils.Prelude.Hashtbl.SeededS
val hash : 'a -> int
val seeded_hash : int -> 'a -> int
val hash_param : int -> int -> 'a -> int
val seeded_hash_param : int -> int -> int -> 'a -> int
val singleton : 'a -> 'b -> ('a, 'b) t
val find_or_else_add : ('a, 'b) t -> 'a -> (unit -> 'b) -> 'b
val map : ('a -> 'b -> 'c * 'd) -> ('a, 'b) t -> ('c, 'd) t

Analog to List.map

val find_map : ('a -> 'b -> 'c option) -> ('a, 'b) Stdlib.Hashtbl.t -> 'c option

Analog to List.find_map

val remove_all : ('a, 'b) t -> 'a -> unit
val of_yojson : (Yojson.Safe.t -> ('a, string) Stdlib.result) -> (Yojson.Safe.t -> ('b, string) Stdlib.result) -> Yojson.Safe.t -> (('a, 'b) t, string) Stdlib.result
val to_yojson : ('a -> Yojson.Safe.t) -> ('b -> Yojson.Safe.t) -> ('a, 'b) t -> Yojson.Safe.t