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
.
val update :
eq:( 'a -> 'a -> bool ) ->
f:( 'b option -> 'b option ) ->
'a ->
( 'a, 'b ) t ->
( 'a, 'b ) t
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'
.
remove ~eq k alist
returns the alist
without the first pair with key k
, if any.
val keys : ( 'a, 'b ) t -> 'a list
keys alist
returns a list of all keys of alist
.
val values : ( 'a, 'b ) t -> 'b list
values alist
returns a list of all values of alist
.