instance
Lean.HashSet.instSingletonHashSet
{α : Type u_1}
[BEq α]
[Hashable α]
:
Singleton α (Lean.HashSet α)
Equations
- Lean.HashSet.instSingletonHashSet = { singleton := fun (x : α) => Lean.HashSet.insert Lean.HashSet.empty x }
instance
Lean.HashSet.instInsertHashSet
{α : Type u_1}
[BEq α]
[Hashable α]
:
Insert α (Lean.HashSet α)
Equations
- Lean.HashSet.instInsertHashSet = { insert := fun (a : α) (s : Lean.HashSet α) => Lean.HashSet.insert s a }
@[specialize #[]]
def
Lean.HashSet.anyM
{α : Type u_1}
[BEq α]
[Hashable α]
{m : Type → Type}
[Monad m]
(s : Lean.HashSet α)
(f : α → m Bool)
:
m Bool
O(n)
. Returns true
if f
returns true
for any element of the set.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
O(n)
. Returns true
if f
returns true
for any element of the set.
Equations
- Lean.HashSet.any s f = Id.run (Lean.HashSet.anyM s f)
Instances For
@[specialize #[]]
def
Lean.HashSet.allM
{α : Type u_1}
[BEq α]
[Hashable α]
{m : Type → Type}
[Monad m]
(s : Lean.HashSet α)
(f : α → m Bool)
:
m Bool
O(n)
. Returns true
if f
returns true
for all elements of the set.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
O(n)
. Returns true
if f
returns true
for all elements of the set.
Equations
- Lean.HashSet.all s f = Id.run (Lean.HashSet.allM s f)
Instances For
Equations
- One or more equations did not get rendered due to their size.
@[inline]
O(1)
amortized. Similar to insert
, but also returns a Boolean flag indicating whether an
existing entry has been replaced with a => b
.
Equations
- Lean.HashSet.insert' s a = let oldSize := Lean.HashSet.size s; let s := Lean.HashSet.insert s a; (s, Lean.HashSet.size s == oldSize)
Instances For
@[inline]
O(n)
. Obtain a HashSet
from an array.
Equations
- Lean.HashSet.ofArray as = Lean.HashSet.insertMany Lean.HashSet.empty as
Instances For
@[inline]
O(n)
. Obtain a HashSet
from a list.
Equations
- Lean.HashSet.ofList as = Lean.HashSet.insertMany Lean.HashSet.empty as