- stage₁ : Bool
- map₁ : Std.HashMap α β
- map₂ : Std.PHashMap α β
Equations
- Lean.SMap.instInhabitedSMap = { default := { stage₁ := true, map₁ := ∅, map₂ := { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 } } }
Equations
- Lean.SMap.empty = { stage₁ := true, map₁ := ∅, map₂ := { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 } }
@[inline]
def
Lean.SMap.fromHashMap
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
(m : Std.HashMap α β)
(stage₁ : optParam Bool true)
:
Lean.SMap α β
Equations
- Lean.SMap.fromHashMap m stage₁ = { stage₁ := stage₁, map₁ := m, map₂ := { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 } }
@[specialize]
Equations
- Lean.SMap.insert x x x = match x, x, x with | { stage₁ := true, map₁ := m₁, map₂ := m₂ }, k, v => { stage₁ := true, map₁ := Std.HashMap.insert m₁ k v, map₂ := m₂ } | { stage₁ := false, map₁ := m₁, map₂ := m₂ }, k, v => { stage₁ := false, map₁ := m₁, map₂ := Std.PersistentHashMap.insert m₂ k v }
@[specialize]
Equations
- Lean.SMap.insert' x x x = match x, x, x with | { stage₁ := true, map₁ := m₁, map₂ := m₂ }, k, v => { stage₁ := true, map₁ := Std.HashMap.insert m₁ k v, map₂ := m₂ } | { stage₁ := false, map₁ := m₁, map₂ := m₂ }, k, v => { stage₁ := false, map₁ := m₁, map₂ := Std.PersistentHashMap.insert m₂ k v }
@[specialize]
Equations
- Lean.SMap.find? x x = match x, x with | { stage₁ := true, map₁ := m₁, map₂ := x }, k => Std.HashMap.find? m₁ k | { stage₁ := false, map₁ := m₁, map₂ := m₂ }, k => Option.orElse (Std.PersistentHashMap.find? m₂ k) fun x => Std.HashMap.find? m₁ k
@[inline]
def
Lean.SMap.findD
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
(m : Lean.SMap α β)
(a : α)
(b₀ : β)
:
β
Equations
- Lean.SMap.findD m a b₀ = Option.getD (Lean.SMap.find? m a) b₀
@[inline]
def
Lean.SMap.find!
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
[inst : Inhabited β]
(m : Lean.SMap α β)
(a : α)
:
β
Equations
- Lean.SMap.find! m a = match Lean.SMap.find? m a with | some b => b | none => panicWithPosWithDecl "Lean.Data.SMap" "Lean.SMap.find!" 62 14 "key is not in the map"
@[specialize]
Equations
- Lean.SMap.contains x x = match x, x with | { stage₁ := true, map₁ := m₁, map₂ := x }, k => Std.HashMap.contains m₁ k | { stage₁ := false, map₁ := m₁, map₂ := m₂ }, k => Std.HashMap.contains m₁ k || Std.PersistentHashMap.contains m₂ k
@[specialize]
Equations
- Lean.SMap.find?' x x = match x, x with | { stage₁ := true, map₁ := m₁, map₂ := x }, k => Std.HashMap.find? m₁ k | { stage₁ := false, map₁ := m₁, map₂ := m₂ }, k => Option.orElse (Std.HashMap.find? m₁ k) fun x => Std.PersistentHashMap.find? m₂ k
def
Lean.SMap.forM
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
{m : Type u_1 → Type u_1}
[inst : Monad m]
(s : Lean.SMap α β)
(f : α → β → m PUnit)
:
m PUnit
Equations
- Lean.SMap.forM s f = do Std.HashMap.forM f s.map₁ Std.PersistentHashMap.forM s.map₂ f
@[inline]
def
Lean.SMap.foldStage2
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
{σ : Type w}
(f : σ → α → β → σ)
(s : σ)
(m : Lean.SMap α β)
:
σ
Equations
- Lean.SMap.foldStage2 f s m = Std.PersistentHashMap.foldl m.map₂ f s
def
Lean.SMap.fold
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
{σ : Type w}
(f : σ → α → β → σ)
(init : σ)
(m : Lean.SMap α β)
:
σ
Equations
- Lean.SMap.fold f init m = Std.PersistentHashMap.foldl m.map₂ f (Std.HashMap.fold f init m.map₁)
def
Lean.SMap.size
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
(m : Lean.SMap α β)
:
Equations
- Lean.SMap.size m = Std.HashMap.size m.map₁ + m.map₂.size
def
Lean.SMap.stageSizes
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
(m : Lean.SMap α β)
:
Equations
- Lean.SMap.stageSizes m = (Std.HashMap.size m.map₁, m.map₂.size)
def
Lean.SMap.numBuckets
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
(m : Lean.SMap α β)
:
Equations
- Lean.SMap.numBuckets m = Std.HashMap.numBuckets m.map₁
def
Lean.SMap.toList
{α : Type u}
{β : Type v}
[inst : BEq α]
[inst : Hashable α]
(m : Lean.SMap α β)
:
Equations
- Lean.SMap.toList m = Lean.SMap.fold (fun es a b => (a, b) :: es) [] m
def
Lean.List.toSMap
{α : Type u_1}
{β : Type u_2}
[inst : BEq α]
[inst : Hashable α]
(es : List (α × β))
:
Lean.SMap α β
Equations
- Lean.List.toSMap es = List.foldl (fun s x => match x with | (a, b) => Lean.SMap.insert s a b) { stage₁ := true, map₁ := ∅, map₂ := { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 } } es
Equations
- Lean.instReprSMap = { reprPrec := fun v prec => Repr.addAppParen (reprArg (Lean.SMap.toList v) ++ Std.Format.text ".toSMap") prec }