alist

alist β is a key-value map stored as a list (i.e. a linked list). It is a wrapper around certain list functions with the added constraint that the list have unique keys.

alist.keys

The list of keys of an association list.

alist.has_mem

The predicate a ∈ s means that s has a value associated to the key a.

alist.has_emptyc

The empty association list.

alist.singleton

The singleton association list.

alist.lookup

Look up the value associated to a key in an association list.

alist.replace

Replace a key with a given value in an association list. If the key is not present it does nothing.

alist.foldl

Fold a function over the key-value pairs in the map.

alist.erase

Erase a key from the map. If the key is not present it does nothing.

alist.insert

Insert a key-value pair into an association list and erase any existing pair with the same key.

alist.extract

Erase a key from the map, and return the corresponding value, if found.

alist.union

s₁ ∪ s₂ is the key-based union of two association lists. It is left-biased: if there exists an a ∈ s₁, lookup a (s₁ ∪ s₂) = lookup a s₁.