AssocList α β
is "the same as" List (α × β)
, but flattening the structure
leads to one fewer pointer indirection (in the current code generator).
It is mainly intended as a component of HashMap
, but it can also be used as a plain
key-value map.
- nil
{α : Type u}
{β : Type v}
: AssocList α β
An empty list
- cons
{α : Type u}
{β : Type v}
(key : α)
(value : β)
(tail : AssocList α β)
: AssocList α β
Add a
key, value
pair to the list
Instances For
instance
Batteries.AssocList.instEmptyCollection
{α : Type u_1}
{β : Type u_2}
:
EmptyCollection (AssocList α β)
Equations
@[simp]
theorem
Batteries.AssocList.findEntryP?_eq
{α : Type u_1}
{β : Type u_2}
(p : α → β → Bool)
(l : AssocList α β)
:
@[simp]
theorem
Batteries.AssocList.findEntry?_eq
{α : Type u_1}
{β : Type u_2}
[BEq α]
(a : α)
(l : AssocList α β)
:
theorem
Batteries.AssocList.find?_eq_findEntry?
{α : Type u_1}
{β : Type u_2}
[BEq α]
(a : α)
(l : AssocList α β)
:
@[specialize #[]]
def
Batteries.AssocList.forIn
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_4}
{δ : Type u_1}
[Monad m]
(as : AssocList α β)
(init : δ)
(f : α × β → δ → m (ForInStep δ))
:
m δ
The implementation of ForIn
, which enables for (k, v) in aList do ...
notation.
Equations
Instances For
Converts a list into an AssocList
. This is the inverse function to AssocList.toList
.
Equations
Instances For
@[simp]
@[simp]
@[simp]