package grenier
Module Physh.MapSource
Maps from objects, compared by physical equality, to arbitrary values. A key has at most one binding.
A mutable map from keys of type 'a to values of type 'b.
create () returns a new, empty map. It does not allocate any storage until the first binding is added: empty maps are cheap.
find_opt t k returns Some v if k is bound to v, None otherwise.
add t k v binds k to v, replacing any existing binding.
add_if_new t k v binds k to v if k is not bound. Returns the previous binding: None if k was absent (it is now bound to v), Some v' if k was bound to v' (left unchanged).
add_overwrite t k v binds k to v, replacing any existing binding. Returns the previous binding: None if k was absent, Some v' if k was bound to v'.
remove t k removes the binding of k. Does nothing if k is not bound.
clear t removes all bindings of t, keeping its storage for reuse.
reset t removes all bindings of t and releases its storage: t is then as cheap as a new map.
iter f t applies f k v to each binding of t, in an unspecified order. f can look up t; if it modifies t, it is unspecified whether the added (or removed) bindings are visited, and which value is passed for an overwritten binding.