instance
Aesop.instInhabitedUnorderedArraySet :
{a : Type u_1} → {a_1 : BEq a} → Inhabited (Aesop.UnorderedArraySet a)
Equations
- Aesop.instInhabitedUnorderedArraySet = { default := { rep := default } }
Equations
- Aesop.UnorderedArraySet.instEmptyCollectionUnorderedArraySet = { emptyCollection := Aesop.UnorderedArraySet.empty }
O(n)
Equations
- Aesop.UnorderedArraySet.insert x✝ x = match x with | { rep := rep } => if Array.contains rep x✝ = true then { rep := rep } else { rep := Array.push rep x✝ }
Instances For
Precondition: xs
contains no duplicates.
Equations
- Aesop.UnorderedArraySet.ofDeduplicatedArray xs = { rep := xs }
Instances For
Precondition: xs
is sorted.
Equations
- Aesop.UnorderedArraySet.ofSortedArray xs = { rep := Array.deduplicateSorted xs }
Instances For
def
Aesop.UnorderedArraySet.ofArray
{α : Type u_1}
[BEq α]
[ord : Ord α]
[Inhabited α]
(xs : Array α)
:
O(n*log(n))
Equations
- Aesop.UnorderedArraySet.ofArray xs = { rep := Array.sortAndDeduplicate xs }
Instances For
O(n^2)
Equations
- Aesop.UnorderedArraySet.ofArraySlow xs = Array.foldl (fun (s : Aesop.UnorderedArraySet α) (x : α) => Aesop.UnorderedArraySet.insert x s) ∅ xs 0
Instances For
Equations
- Aesop.UnorderedArraySet.ofHashSet xs = { rep := Lean.HashSet.toArray xs }
Instances For
def
Aesop.UnorderedArraySet.ofPersistentHashSet
{α : Type u_1}
[BEq α]
[Hashable α]
(xs : Lean.PersistentHashSet α)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Aesop.UnorderedArraySet.toArray s = s.rep
Instances For
O(n)
Equations
- Aesop.UnorderedArraySet.erase x s = { rep := Array.erase s.rep x }
Instances For
def
Aesop.UnorderedArraySet.filterM
{α : Type}
[BEq α]
{m : Type → Type u_1}
[Monad m]
(p : α → m Bool)
(s : Aesop.UnorderedArraySet α)
:
m (Aesop.UnorderedArraySet α)
O(n)
Equations
- Aesop.UnorderedArraySet.filterM p s = do let __do_lift ← Array.filterM p s.rep 0 pure { rep := __do_lift }
Instances For
def
Aesop.UnorderedArraySet.filter
{α : Type u_1}
[BEq α]
(p : α → Bool)
(s : Aesop.UnorderedArraySet α)
:
O(n)
Equations
- Aesop.UnorderedArraySet.filter p s = { rep := Array.filter p s.rep 0 }
Instances For
def
Aesop.UnorderedArraySet.merge
{α : Type u_1}
[BEq α]
(s : Aesop.UnorderedArraySet α)
(t : Aesop.UnorderedArraySet α)
:
O(n*m)
Equations
- Aesop.UnorderedArraySet.merge s t = { rep := Array.mergeUnsortedDeduplicating s.rep t.rep }
Instances For
Equations
- Aesop.UnorderedArraySet.instAppendUnorderedArraySet = { append := Aesop.UnorderedArraySet.merge }
def
Aesop.UnorderedArraySet.contains
{α : Type u_1}
[BEq α]
(x : α)
(s : Aesop.UnorderedArraySet α)
:
O(n)
Equations
- Aesop.UnorderedArraySet.contains x s = Array.contains s.rep x
Instances For
def
Aesop.UnorderedArraySet.foldM
{α : Type u_1}
[BEq α]
{m : Type u_2 → Type u_3}
{σ : Type u_2}
[Monad m]
(f : σ → α → m σ)
(init : σ)
(s : Aesop.UnorderedArraySet α)
:
m σ
O(n)
Equations
- Aesop.UnorderedArraySet.foldM f init s = Array.foldlM f init s.rep 0
Instances For
instance
Aesop.UnorderedArraySet.instForInUnorderedArraySet
{α : Type u_1}
[BEq α]
{m : Type u_2 → Type u_3}
[Monad m]
:
ForIn m (Aesop.UnorderedArraySet α) α
Equations
- Aesop.UnorderedArraySet.instForInUnorderedArraySet = { forIn := fun {β : Type u_2} [Monad m] (s : Aesop.UnorderedArraySet α) => Array.forIn s.rep }
def
Aesop.UnorderedArraySet.fold
{α : Type u_1}
[BEq α]
{σ : Type u_2}
(f : σ → α → σ)
(init : σ)
(s : Aesop.UnorderedArraySet α)
:
σ
O(n)
Equations
- Aesop.UnorderedArraySet.fold f init s = Array.foldl f init s.rep 0
Instances For
def
Aesop.UnorderedArraySet.partition
{α : Type u_1}
[BEq α]
(f : α → Bool)
(s : Aesop.UnorderedArraySet α)
:
Equations
- Aesop.UnorderedArraySet.partition f s = match Array.partition f s.rep with | (xs, ys) => ({ rep := xs }, { rep := ys })
Instances For
O(1)
Equations
Instances For
def
Aesop.UnorderedArraySet.anyM
{α : Type u_1}
[BEq α]
{m : Type → Type u_2}
[Monad m]
(p : α → m Bool)
(s : Aesop.UnorderedArraySet α)
(start : optParam Nat 0)
(stop : optParam Nat (Aesop.UnorderedArraySet.size s))
:
m Bool
O(n)
Equations
- Aesop.UnorderedArraySet.anyM p s start stop = Array.anyM p s.rep start stop
Instances For
def
Aesop.UnorderedArraySet.any
{α : Type u_1}
[BEq α]
(p : α → Bool)
(s : Aesop.UnorderedArraySet α)
(start : optParam Nat 0)
(stop : optParam Nat (Aesop.UnorderedArraySet.size s))
:
O(n)
Equations
- Aesop.UnorderedArraySet.any p s start stop = Array.any s.rep p start stop
Instances For
def
Aesop.UnorderedArraySet.allM
{α : Type u_1}
[BEq α]
{m : Type → Type u_2}
[Monad m]
(p : α → m Bool)
(s : Aesop.UnorderedArraySet α)
(start : optParam Nat 0)
(stop : optParam Nat (Aesop.UnorderedArraySet.size s))
:
m Bool
O(n)
Equations
- Aesop.UnorderedArraySet.allM p s start stop = Array.allM p s.rep start stop
Instances For
def
Aesop.UnorderedArraySet.all
{α : Type u_1}
[BEq α]
(p : α → Bool)
(s : Aesop.UnorderedArraySet α)
(start : optParam Nat 0)
(stop : optParam Nat (Aesop.UnorderedArraySet.size s))
:
O(n)
Equations
- Aesop.UnorderedArraySet.all p s start stop = Array.all s.rep p start stop
Instances For
Equations
- Aesop.UnorderedArraySet.instBEqUnorderedArraySet = { beq := fun (s t : Aesop.UnorderedArraySet α) => Array.equalSet s.rep t.rep }
instance
Aesop.UnorderedArraySet.instToStringUnorderedArraySet
{α : Type u_1}
[BEq α]
[ToString α]
:
Equations
- Aesop.UnorderedArraySet.instToStringUnorderedArraySet = { toString := fun (s : Aesop.UnorderedArraySet α) => toString s.rep }
instance
Aesop.UnorderedArraySet.instToFormatUnorderedArraySet
{α : Type u_1}
[BEq α]
[Lean.ToFormat α]
:
Equations
- Aesop.UnorderedArraySet.instToFormatUnorderedArraySet = { format := fun (s : Aesop.UnorderedArraySet α) => Std.format s.rep }
instance
Aesop.UnorderedArraySet.instToMessageDataUnorderedArraySet
{α : Type}
[BEq α]
[Lean.ToMessageData α]
:
Equations
- Aesop.UnorderedArraySet.instToMessageDataUnorderedArraySet = { toMessageData := fun (s : Aesop.UnorderedArraySet α) => Lean.toMessageData s.rep }