Hashtbl.Xt
Explicit transaction log passing on hash tables.
length t
returns the number of bindings in the hash table t
.
⚠️ The returned value may be greater than the number of distinct keys in the hash table.
reset t
remove all bindings from the hash table t
and shrinks the capacity of the table back to the minimum.
swap t1 t2
exchanges the contents of the hash tables t1
and t2
.
remove t k
removes the most recent existing binding of key k
, if any, from the hash table t
thereby revealing the earlier binding of k
, if any.
add t k v
adds a binding of key k
to value v
to the hash table shadowing the previous binding of the key k
, if any.
⚠️ Consider using replace
instead of add
.
replace t k v
adds a binding of key k
to value v
or replaces the most recent existing binding of key k
in the hash table t
.
mem t k
is equivalent to Option.is_some (find_opt t k)
.
find_opt t k
returns the current binding of key k
in the hash table t
, or None
if no such binding exists.