Module CCListLabels.Assoc

type ('a, 'b) t = ('a * 'b) list
val get : eq:('a ‑> 'a ‑> bool) ‑> 'a ‑> ('a'bt ‑> 'b option

Find the element.

val get_exn : eq:('a ‑> 'a ‑> bool) ‑> 'a ‑> ('a'bt ‑> 'b

Like get, but unsafe.

val set : eq:('a ‑> 'a ‑> bool) ‑> 'a ‑> 'b ‑> ('a'bt ‑> ('a'bt

Add the binding into the list (erase it if already present).

val mem : eq:('a ‑> 'a ‑> bool) ‑> 'a ‑> ('a_t ‑> bool

mem x l returns true iff x is a key in l.

val update : eq:('a ‑> 'a ‑> bool) ‑> f:('b option ‑> 'b option) ‑> 'a ‑> ('a'bt ‑> ('a'bt

update k ~f l updates l on the key k, by calling f (get l k) and removing k if it returns None, mapping k to v' if it returns Some v'.

val remove : eq:('a ‑> 'a ‑> bool) ‑> 'a ‑> ('a'bt ‑> ('a'bt

remove x l removes the first occurrence of k from l.