package server-reason-react
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b97fbe6a7c3e5e1a7775e0f6498f257acaaa7e272177a9a3e0e50b7a49408d7c
sha512=b27a94618c367c80efef83a41c2a59c9cc7848fd753049ed40fa1f2cface1ef34cf3a995835bf08e2eb59c3186911f429b4706ed07dcb9724df6af5eb012a31d
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