MultiMap #
This module defines a generic MultiMap type that maps keys to multiple values while
remembering the order in which entries were inserted.
Entries live in one array and lookups scan it. Header maps hold at most a few dozen entries and see a handful of lookups per message, so a scan costs less than maintaining any index on insert.
@[instance_reducible]
Equations
@[instance_reducible]
Equations
@[instance_reducible]
instance Std.Internal.MultiMap.instMembershipOfBEq {α : Type u} {β : Type v} [BEq α] :
Membership α (MultiMap α β)
@[inline]
def Std.Internal.MultiMap.insert {α : Type u} {β : Type v} (map : MultiMap α β) (key : α) (value : β) :
MultiMap α β
Inserts a new key-value pair into the map. If the key already exists, appends the value to existing values.
Instances For
Creates an empty multimap.
Equations
- Std.Internal.MultiMap.empty = { entries := Array.emptyWithCapacity 8 }
Instances For
@[instance_reducible]
instance Std.Internal.MultiMap.instEmptyCollection {α : Type u} {β : Type v} :
EmptyCollection (MultiMap α β)
Equations
- Std.Internal.MultiMap.instEmptyCollection = { emptyCollection := Std.Internal.MultiMap.empty }
@[instance_reducible]
Equations
@[instance_reducible]
instance Std.Internal.MultiMap.instForInProdOfMonad {α : Type u} {β : Type v} {m : Type u_1 → Type u_2} [Monad m] :
Equations
- Std.Internal.MultiMap.instForInProdOfMonad = { forIn := fun {β_1 : Type ?u.2} (map : Std.Internal.MultiMap α β) (b : β_1) (f : α × β → β_1 → m (ForInStep β_1)) => forIn map.entries b f }