- node: {α : Type u} → Array (Lean.PersistentArrayNode α) → Lean.PersistentArrayNode α
- leaf: {α : Type u} → Array α → Lean.PersistentArrayNode α
Instances For
instance
Lean.instInhabitedPersistentArrayNode :
{a : Type u_1} → Inhabited (Lean.PersistentArrayNode a)
Equations
- Lean.instInhabitedPersistentArrayNode = { default := Lean.PersistentArrayNode.node default }
Equations
- x.isNode = match x with | Lean.PersistentArrayNode.node cs => true | Lean.PersistentArrayNode.leaf vs => false
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
Instances For
- root : Lean.PersistentArrayNode α
- tail : Array α
- size : Nat
- shift : USize
- tailOff : Nat
Instances For
Equations
- Lean.instInhabitedPersistentArray = { default := { root := default, tail := default, size := default, shift := default, tailOff := default } }
@[reducible, inline]
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- Lean.PersistentArray.mkEmptyArray = Array.mkEmpty Lean.PersistentArray.branching.toNat
Instances For
@[reducible, inline]
Equations
- Lean.PersistentArray.mul2Shift i shift = i.shiftLeft shift
Instances For
@[reducible, inline]
Equations
- Lean.PersistentArray.div2Shift i shift = i.shiftRight shift
Instances For
@[reducible, inline]
Equations
- Lean.PersistentArray.mod2Shift i shift = i.land (USize.shiftLeft 1 shift - 1)
Instances For
partial def
Lean.PersistentArray.getAux
{α : Type u}
[Inhabited α]
:
Lean.PersistentArrayNode α → USize → USize → α
Equations
- t.get! i = if i ≥ t.tailOff then t.tail.get! (i - t.tailOff) else Lean.PersistentArray.getAux t.root (USize.ofNat i) t.shift
Instances For
instance
Lean.PersistentArray.instGetElemNatLtSizeOfInhabited
{α : Type u}
[Inhabited α]
:
GetElem (Lean.PersistentArray α) Nat α fun (as : Lean.PersistentArray α) (i : Nat) => i < as.size
Equations
- Lean.PersistentArray.instGetElemNatLtSizeOfInhabited = { getElem := fun (xs : Lean.PersistentArray α) (i : Nat) (x : i < xs.size) => xs.get! i }
partial def
Lean.PersistentArray.setAux
{α : Type u}
:
Lean.PersistentArrayNode α → USize → USize → α → Lean.PersistentArrayNode α
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[specialize #[]]
@[specialize #[]]
def
Lean.PersistentArray.modify
{α : Type u}
[Inhabited α]
(t : Lean.PersistentArray α)
(i : Nat)
(f : α → α)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
partial def
Lean.PersistentArray.insertNewLeaf
{α : Type u}
:
Lean.PersistentArrayNode α → USize → USize → Array α → Lean.PersistentArrayNode α
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
partial def
Lean.PersistentArray.popLeaf
{α : Type u}
:
Lean.PersistentArrayNode α → Option (Array α) × Array (Lean.PersistentArrayNode α)
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[specialize #[]]
def
Lean.PersistentArray.foldlM
{α : Type u}
{m : Type v → Type w}
[Monad m]
{β : Type v}
(t : Lean.PersistentArray α)
(f : β → α → m β)
(init : β)
(start : optParam Nat 0)
:
m β
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[specialize #[]]
def
Lean.PersistentArray.foldrM
{α : Type u}
{m : Type v → Type w}
{β : Type v}
[Monad m]
(t : Lean.PersistentArray α)
(f : α → β → m β)
(init : β)
:
m β
Equations
- t.foldrM f init = do let __do_lift ← Array.foldrM f init t.tail Lean.PersistentArray.foldrMAux f t.root __do_lift
Instances For
@[specialize #[]]
def
Lean.PersistentArray.forIn
{α : Type u}
{m : Type v → Type w}
[Monad m]
{β : Type v}
(t : Lean.PersistentArray α)
(init : β)
(f : α → β → m (ForInStep β))
:
m β
Equations
- One or more equations did not get rendered due to their size.
Instances For
instance
Lean.PersistentArray.instForIn
{α : Type u}
{m : Type v → Type w}
:
ForIn m (Lean.PersistentArray α) α
@[specialize #[]]
partial def
Lean.PersistentArray.findSomeMAux
{α : Type u}
{m : Type v → Type w}
[Monad m]
{β : Type v}
(f : α → m (Option β))
:
Lean.PersistentArrayNode α → m (Option β)
@[specialize #[]]
def
Lean.PersistentArray.findSomeM?
{α : Type u}
{m : Type v → Type w}
[Monad m]
{β : Type v}
(t : Lean.PersistentArray α)
(f : α → m (Option β))
:
m (Option β)
Equations
- t.findSomeM? f = do let __do_lift ← Lean.PersistentArray.findSomeMAux f t.root match __do_lift with | none => t.tail.findSomeM? f | some b => pure (some b)
Instances For
@[specialize #[]]
partial def
Lean.PersistentArray.findSomeRevMAux
{α : Type u}
{m : Type v → Type w}
[Monad m]
{β : Type v}
(f : α → m (Option β))
:
Lean.PersistentArrayNode α → m (Option β)
@[specialize #[]]
def
Lean.PersistentArray.findSomeRevM?
{α : Type u}
{m : Type v → Type w}
[Monad m]
{β : Type v}
(t : Lean.PersistentArray α)
(f : α → m (Option β))
:
m (Option β)
Equations
- t.findSomeRevM? f = do let __do_lift ← t.tail.findSomeRevM? f match __do_lift with | none => Lean.PersistentArray.findSomeRevMAux f t.root | some b => pure (some b)
Instances For
@[specialize #[]]
def
Lean.PersistentArray.forM
{α : Type u}
{m : Type v → Type w}
[Monad m]
(t : Lean.PersistentArray α)
(f : α → m PUnit)
:
m PUnit
Equations
- t.forM f = SeqRight.seqRight (Lean.PersistentArray.forMAux f t.root) fun (x : Unit) => Array.forM f t.tail
Instances For
@[inline]
def
Lean.PersistentArray.foldl
{α : Type u}
{β : Type u_1}
(t : Lean.PersistentArray α)
(f : β → α → β)
(init : β)
(start : optParam Nat 0)
:
β
Equations
- t.foldl f init start = (t.foldlM f init start).run
Instances For
@[inline]
def
Lean.PersistentArray.foldr
{α : Type u}
{β : Type u_1}
(t : Lean.PersistentArray α)
(f : α → β → β)
(init : β)
:
β
Equations
- t.foldr f init = (t.foldrM f init).run
Instances For
@[inline]
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- t.toArray = t.foldl Array.push #[]
Instances For
def
Lean.PersistentArray.append
{α : Type u}
(t₁ : Lean.PersistentArray α)
(t₂ : Lean.PersistentArray α)
:
Instances For
Equations
- Lean.PersistentArray.instAppend = { append := Lean.PersistentArray.append }
@[inline]
def
Lean.PersistentArray.findSome?
{α : Type u}
{β : Type u_1}
(t : Lean.PersistentArray α)
(f : α → Option β)
:
Option β
Equations
- t.findSome? f = (t.findSomeM? f).run
Instances For
@[inline]
def
Lean.PersistentArray.findSomeRev?
{α : Type u}
{β : Type u_1}
(t : Lean.PersistentArray α)
(f : α → Option β)
:
Option β
Equations
- t.findSomeRev? f = (t.findSomeRevM? f).run
Instances For
Instances For
@[specialize #[]]
partial def
Lean.PersistentArray.anyMAux
{α : Type u}
{m : Type → Type w}
[Monad m]
(p : α → m Bool)
:
Lean.PersistentArrayNode α → m Bool
@[specialize #[]]
def
Lean.PersistentArray.anyM
{α : Type u}
{m : Type → Type w}
[Monad m]
(t : Lean.PersistentArray α)
(p : α → m Bool)
:
m Bool
Equations
- t.anyM p = (Lean.PersistentArray.anyMAux p t.root <||> Array.anyM p t.tail)
Instances For
@[inline]
Instances For
@[specialize #[]]
def
Lean.PersistentArray.mapM
{α : Type u}
{m : Type u → Type v}
[Monad m]
{β : Type u}
(f : α → m β)
(t : Lean.PersistentArray α)
:
m (Lean.PersistentArray β)
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
Equations
- Lean.PersistentArray.map f t = (Lean.PersistentArray.mapM f t).run
Instances For
Equations
- r.stats = Lean.PersistentArray.collectStats r.root { numNodes := 0, depth := 0, tailSize := r.tail.size } 0
Instances For
Equations
Equations
- Lean.mkPersistentArray n v = Nat.fold (fun (x : Nat) (p : Lean.PArray α) => Lean.PersistentArray.push p v) n Lean.PersistentArray.empty
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- List.toPArray'.loop [] x = x
- List.toPArray'.loop (x_2 :: xs) x = List.toPArray'.loop xs (x.push x_2)
Instances For
Equations
- xs.toPArray' = Array.foldl (fun (p : Lean.PersistentArray α) (x : α) => p.push x) Lean.PersistentArray.empty xs