Module CCListLabels.Assoc
val get : eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) t -> 'b option
get ~eq k alist
returnsSome v
if the given keyk
is present intoalist
, orNone
if not present.
val get_exn : eq:('a -> 'a -> bool) -> 'a -> ('a, 'b) t -> 'b
get_exn ~eq k alist
returnsv
if the elementk
is present intoalist
. Likeget
, but unsafe.- raises Not_found
if the element is not present.
val set : eq:('a -> 'a -> bool) -> 'a -> 'b -> ('a, 'b) t -> ('a, 'b) t
set ~eq k v alist
adds the bindingk, v
into the listalist
(erase it if already present).
val mem : ?eq:('a -> 'a -> bool) -> 'a -> ('a, _) t -> bool
mem ?eq k alist
returnstrue
iffk
is a key inalist
.- since
- 0.16