CCListLabels.Assoc
val get : eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) t -> 'b option
get ~eq k alist
returns Some v
if the given key k
is present into alist
, or None
if not present.
val get_exn : eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) t -> 'b
get_exn ~eq k alist
returns v
if the element k
is present into alist
. Like get
, but unsafe.
set ~eq k v alist
adds the binding k, v
into the list alist
(erase it if already present).
val mem : ?eq:('a -> 'a -> bool) -> 'a -> ('a, _) t -> bool
mem ?eq k alist
returns true
iff k
is a key in alist
.
update ~eq ~f k alist
updates alist
on the key k
, by calling f (get alist k)
and removing k
if it returns None
, mapping k
to v'
if it returns Some v'
.