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}
: Std.DHashMap.Internal.AssocList α β
Internal implementation detail of the hash map
- cons
{α : Type u}
{β : α → Type v}
(key : α)
(value : β key)
(tail : Std.DHashMap.Internal.AssocList α β)
: Std.DHashMap.Internal.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
Instances For
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
Instances For
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
Instances For
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
Instances For
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
Instances For
Internal implementation detail of the hash map
Equations
- as.forInStep init f = Std.DHashMap.Internal.AssocList.forInStep.go f as init
Instances For
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✝)
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.nil.toList = []
- (Std.DHashMap.Internal.AssocList.cons a b es).toList = ⟨a, b⟩ :: es.toList
Instances For
Internal implementation detail of the hash map
Equations
- l.length = Std.DHashMap.Internal.AssocList.foldl (fun (n : Nat) (x : α) (x : β x) => n + 1) 0 l
Instances For
Internal implementation detail of the hash map
Equations
Instances For
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
Instances For
Internal implementation detail of the hash map
Equations
Instances For
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 ⋯
Instances For
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 ⋯
Instances For
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 ⋯
Instances For
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
Instances For
Internal implementation detail of the hash map
Equations
- Std.DHashMap.Internal.AssocList.getKey? a Std.DHashMap.Internal.AssocList.nil = none
- Std.DHashMap.Internal.AssocList.getKey? a (Std.DHashMap.Internal.AssocList.cons a_1 b es) = if (a_1 == a) = true then some a_1 else Std.DHashMap.Internal.AssocList.getKey? a es
Instances For
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
Instances For
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
Instances For
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
Instances For
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
Instances For
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
Instances For
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
Instances For
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
Instances For
Internal implementation detail of the hash map
Equations
Instances For
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
Instances For
Internal implementation detail of the hash map
Equations
Instances For
Equations
Instances For
Internal implementation detail of the hash map
Equations
Instances For
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