- node: {α : Type u} → Array (Lean.PersistentArrayNode α) → Lean.PersistentArrayNode α
- leaf: {α : Type u} → Array α → Lean.PersistentArrayNode α
Instances For
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
- 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]
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
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
- 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 α)
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 : Nat := 0)
:
m β
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 β
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 => Array.findSomeM? f t.tail | 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 ← Array.findSomeRevM? f t.tail 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
Instances For
@[inline]
def
Lean.PersistentArray.foldl
{α : Type u}
{β : Type u_1}
(t : Lean.PersistentArray α)
(f : β → α → β)
(init : β)
(start : 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
Instances For
@[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 β
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 β)
Instances For
@[inline]
Instances For
Instances For
Equations
- Lean.mkPersistentArray n v = n.fold (fun (x : Nat) (x : x < n) (p : Lean.PArray α) => Lean.PersistentArray.push p v) Lean.PersistentArray.empty
Instances For
Equations
- One or more equations did not get rendered due to their size.