This is an internal implementation file of the hash map. Users of the hash map should not rely on the contents of this file.
Note that some functions in this file (in particular, foldrM
, foldr
, toList
, replace
, and
erase
) are not tail-recursive. This is not a problem because they are only used internally by
HashMap
, where AssocList
is always small. Before making this API public, we would need to add
@[csimp]
lemmas for tail-recursive implementations.
File contents: Operations on associative lists
AssocList α β
is "the same as" List (α × β)
, but flattening the structure
leads to one fewer pointer indirection (in the current code generator).
- nil
{α : Type u}
{β : α → Type v}
: AssocList α β
Internal implementation detail of the hash map
- cons
{α : Type u}
{β : α → Type v}
(key : α)
(value : β key)
(tail : AssocList α β)
: AssocList α β
Internal implementation detail of the hash map
Instances For
Equations
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.foldlM f x✝ Std.DHashMap.Internal.AssocList.nil = pure x✝
- Std.DHashMap.Internal.AssocList.foldlM f x✝ (Std.DHashMap.Internal.AssocList.cons a b es) = do let d ← f x✝ a b Std.DHashMap.Internal.AssocList.foldlM f d es
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.foldl f init as = (Std.DHashMap.Internal.AssocList.foldlM f init as).run
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.foldrM f x✝ Std.DHashMap.Internal.AssocList.nil = pure x✝
- Std.DHashMap.Internal.AssocList.foldrM f x✝ (Std.DHashMap.Internal.AssocList.cons a b es) = do let d ← Std.DHashMap.Internal.AssocList.foldrM f x✝ es f a b d
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.foldr f init as = (Std.DHashMap.Internal.AssocList.foldrM f init as).run
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.forM f as = Std.DHashMap.Internal.AssocList.foldlM (fun (x : PUnit) => f) PUnit.unit as
Internal implementation detail of the hash map
Equations
- as.forInStep init f = Std.DHashMap.Internal.AssocList.forInStep.go f as init
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.forInStep.go f Std.DHashMap.Internal.AssocList.nil x✝ = pure (ForInStep.yield x✝)
Internal implementation detail of the hash map
Equations
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.getCast? a Std.DHashMap.Internal.AssocList.nil = none
- Std.DHashMap.Internal.AssocList.getCast? a (Std.DHashMap.Internal.AssocList.cons a_1 b es) = if h : (a_1 == a) = true then some (cast ⋯ b) else Std.DHashMap.Internal.AssocList.getCast? a es
Internal implementation detail of the hash map
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.get a (Std.DHashMap.Internal.AssocList.cons k v es) h = if hka : (k == a) = true then v else Std.DHashMap.Internal.AssocList.get a es ⋯
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.getCast a (Std.DHashMap.Internal.AssocList.cons k v es) h = if hka : (k == a) = true then cast ⋯ v else Std.DHashMap.Internal.AssocList.getCast a es ⋯
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.getKey a (Std.DHashMap.Internal.AssocList.cons k v es) h = if hka : (k == a) = true then k else Std.DHashMap.Internal.AssocList.getKey a es ⋯
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.getCast! a (Std.DHashMap.Internal.AssocList.cons a_1 b es) = if h : (a_1 == a) = true then cast ⋯ b else Std.DHashMap.Internal.AssocList.getCast! a es
Internal implementation detail of the hash map
Equations
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.get! a (Std.DHashMap.Internal.AssocList.cons k v es) = bif k == a then v else Std.DHashMap.Internal.AssocList.get! a es
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.getKey! a (Std.DHashMap.Internal.AssocList.cons a_1 b es) = if (a_1 == a) = true then a_1 else Std.DHashMap.Internal.AssocList.getKey! a es
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.getCastD a fallback Std.DHashMap.Internal.AssocList.nil = fallback
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.getD a fallback Std.DHashMap.Internal.AssocList.nil = fallback
- Std.DHashMap.Internal.AssocList.getD a fallback (Std.DHashMap.Internal.AssocList.cons k v es) = bif k == a then v else Std.DHashMap.Internal.AssocList.getD a fallback es
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.getKeyD a fallback Std.DHashMap.Internal.AssocList.nil = fallback
- Std.DHashMap.Internal.AssocList.getKeyD a fallback (Std.DHashMap.Internal.AssocList.cons a_1 b es) = if (a_1 == a) = true then a_1 else Std.DHashMap.Internal.AssocList.getKeyD a fallback es
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.replace a b Std.DHashMap.Internal.AssocList.nil = Std.DHashMap.Internal.AssocList.nil
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.erase a Std.DHashMap.Internal.AssocList.nil = Std.DHashMap.Internal.AssocList.nil
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.modify a f Std.DHashMap.Internal.AssocList.nil = Std.DHashMap.Internal.AssocList.nil
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.Const.modify a f Std.DHashMap.Internal.AssocList.nil = Std.DHashMap.Internal.AssocList.nil
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.filterMap.go f acc Std.DHashMap.Internal.AssocList.nil = acc
Internal implementation detail of the hash map
Equations
Internal implementation detail of the hash map
Equations
- One or more equations did not get rendered due to their size.
- Std.DHashMap.Internal.AssocList.filter.go f acc Std.DHashMap.Internal.AssocList.nil = acc