package extlib

  1. Overview
  2. Docs

Module ExtHashtbl.HashtblSource

Sourcetype ('a, 'b) t = ('a, 'b) Hashtbl.t

The type of a hashtable.

New Functions
Sourceval exists : ('a, 'b) t -> 'a -> bool

exists h k returns true is at least one item with key k is found in the hashtable.

Sourceval keys : ('a, 'b) t -> 'a Enum.t

Return an enumeration of all the keys of a hashtable. If the key is in the Hashtable multiple times, all occurrences will be returned.

Sourceval values : ('a, 'b) t -> 'b Enum.t

Return an enumeration of all the values of a hashtable.

Sourceval enum : ('a, 'b) t -> ('a * 'b) Enum.t

Return an enumeration of (key,value) pairs of a hashtable.

Sourceval of_enum : ('a * 'b) Enum.t -> ('a, 'b) t

Create a hashtable from a (key,value) enumeration.

Sourceval find_default : ('a, 'b) t -> 'a -> 'b -> 'b

Find a binding for the key, and return a default value if not found

Sourceval find_opt : ('a, 'b) Hashtbl.t -> 'a -> 'b option

Find a binding for the key, or return None if no value is found

Sourceval find_option : ('a, 'b) Hashtbl.t -> 'a -> 'b option

compatibility, use find_opt

Sourceval remove_all : ('a, 'b) t -> 'a -> unit

Remove all bindings for the given key

Sourceval map : ('b -> 'c) -> ('a, 'b) t -> ('a, 'c) t

map f x creates a new hashtable with the same keys as x, but with the function f applied to all the values

Sourceval length : ('a, 'b) t -> int

Return the number of elements inserted into the Hashtbl (including duplicates)

Sourceval reset : ('a, 'b) t -> unit
Sourceval randomize : unit -> unit
Sourcetype statistics = Hashtbl.statistics = {
  1. num_bindings : int;
  2. num_buckets : int;
  3. max_bucket_length : int;
  4. bucket_histogram : int array;
}
Sourceval stats : ('a, 'b) t -> statistics
Sourceval seeded_hash_param : int -> int -> int -> 'a -> int
Sourceval seeded_hash : int -> 'a -> int
Sourceval is_randomized : unit -> bool
Sourceval filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit
Older Functions

Please refer to the Ocaml Manual for documentation of these functions.

Sourceval create : ?random:bool -> int -> ('a, 'b) t
Sourceval clear : ('a, 'b) t -> unit
Sourceval add : ('a, 'b) t -> 'a -> 'b -> unit
Sourceval copy : ('a, 'b) t -> ('a, 'b) t
Sourceval find : ('a, 'b) t -> 'a -> 'b
Sourceval find_all : ('a, 'b) t -> 'a -> 'b list
Sourceval mem : ('a, 'b) t -> 'a -> bool
Sourceval remove : ('a, 'b) t -> 'a -> unit
Sourceval replace : ('a, 'b) t -> 'a -> 'b -> unit
Sourceval iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit
Sourceval fold : ('a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c
Sourceval hash : 'a -> int
Sourceval hash_param : int -> int -> 'a -> int
Sourceval to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

*_seq functions were introduced in OCaml 4.07.0, and are _not_ implemented in extlib for older OCaml versions

Sourceval to_seq_keys : ('a, _) t -> 'a Seq.t
Sourceval to_seq_values : (_, 'b) t -> 'b Seq.t
Sourceval add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit
Sourceval replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit
Sourceval of_seq : ('a * 'b) Seq.t -> ('a, 'b) t
Sourceval rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

Functor interface forwards directly to stdlib implementation (i.e. no enum functions)

Sourcemodule type HashedType = Hashtbl.HashedType
Sourcemodule type S = Hashtbl.S
Sourcemodule Make = Hashtbl.Make
Sourcemodule type SeededHashedType = Hashtbl.SeededHashedType
Sourcemodule type SeededS = Hashtbl.SeededS
Sourcemodule MakeSeeded = Hashtbl.MakeSeeded
OCaml

Innovation. Community. Security.