package server-reason-react
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=2a6fc7197d251dc91babcf22cb6987e1d07e91ae631cc62a893df2c6da6b49b5
sha512=c6ed6eb39b046b698844e561cf9a42a866e4df632a6e495a6473ba629ecd9ee534db0b5b42737776d9a4b15376bea1380b77749228c88a0fc0f6b10ead4b3a01
doc/server-reason-react.belt/Belt/HashSet/index.html
Module Belt.HashSet
The top level provides generic mutable hash set operations.
It also has two specialized inner modules Belt.HashSet.Int and Belt.HashSet.String
A mutable Hash set which allows customized hash behavior.
All data are parameterized by not its only type but also a unique identity in the time of initialization, so that two HashSets of ints initialized with different hash functions will have different type.
For example:
type t = int
module I0 =
(val Belt.Id.hashableU
~hash:(fun[\@bs] (a : t) -> a & 0xff_ff)
~eq:(fun[\@bs] a b -> a = b)
)
let s0 = make ~id:(module I0) ~hintSize:40
module I1 =
(val Belt.Id.hashableU
~hash:(fun[\@bs] (a : t) -> a & 0xff)
~eq:(fun[\@bs] a b -> a = b)
)
let s1 = make ~id:(module I1) ~hintSize:40The invariant must be held: for two elements who are equal, their hashed value should be the same
Here the compiler would infer s0 and s1 having different type so that it would not mix.
val s0 : (int, I0.identity) t
val s1 : (int, I1.identity) tWe can add elements to the collection:
let () =
add s1 0;
add s1 1Since this is an mutable data strucure, s1 will contain two pairs.
Specalized when key type is string, more efficient than the generic type
The type of hash tables from type 'a to type 'b.
val clear : ('a, 'id) t -> unitval isEmpty : (_, _) t -> boolval add : ('a, 'id) t -> 'a -> unitval has : ('a, 'id) t -> 'a -> boolval remove : ('a, 'id) t -> 'a -> unitval forEachU : ('a, 'id) t -> ('a -> unit) -> unitval forEach : ('a, 'id) t -> ('a -> unit) -> unitOrder unspecified.
val reduceU : ('a, 'id) t -> 'c -> ('c -> 'a -> 'c) -> 'cval reduce : ('a, 'id) t -> 'c -> ('c -> 'a -> 'c) -> 'cOrder unspecified.
val size : ('a, 'id) t -> intval logStats : (_, _) t -> unitval toArray : ('a, 'id) t -> 'a arrayval mergeMany : ('a, 'id) t -> 'a array -> unitval getBucketHistogram : (_, _) t -> int array