- node {α : Type u} (cs : Array (PersistentArrayNode α)) : PersistentArrayNode α
- leaf {α : Type u} (vs : Array α) : PersistentArrayNode α
Instances For
@[instance_reducible]
Equations
Equations
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Instances For
- root : PersistentArrayNode α
- tail : Array α
- size : Nat
- shift : USize
- tailOff : Nat
Instances For
@[instance_reducible]
Equations
@[reducible, inline]
Equations
Instances For
Equations
Instances For
Instances For
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 α] :
PersistentArrayNode α → USize → USize → α
@[instance_reducible]
instance Lean.PersistentArray.instGetElemNatLtSizeOfInhabited {α : Type u} [Inhabited α] :
GetElem (PersistentArray α) Nat α fun (as : 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} :
PersistentArrayNode α → USize → USize → α → PersistentArrayNode α
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[specialize #[]]
partial def Lean.PersistentArray.modifyAux {α : Type u} [Inhabited α] (f : α → α) :
PersistentArrayNode α → USize → USize → PersistentArrayNode α
@[specialize #[]]
def Lean.PersistentArray.modify {α : Type u} [Inhabited α] (t : 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} :
PersistentArrayNode α → USize → USize → Array α → 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} :
PersistentArrayNode α → Option (Array α) × Array (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 : PersistentArray α) (f : β → α → m β) (init : β) (start : 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 : 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 : PersistentArray α) (init : β) (f : α → β → m (ForInStep β)) :
m β
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
instance Lean.PersistentArray.instForInOfMonad {α : Type u} {m : Type v → Type w} [Monad m] :
ForIn m (PersistentArray α) α
Equations
- Lean.PersistentArray.instForInOfMonad = { forIn := fun {β : Type ?u.2} => Lean.PersistentArray.forIn }
@[specialize #[]]
partial def Lean.PersistentArray.findSomeMAux {α : Type u} {m : Type v → Type w} [Monad m] {β : Type v} (f : α → m (Option β)) :
PersistentArrayNode α → m (Option β)
@[specialize #[]]
def Lean.PersistentArray.findSomeM? {α : Type u} {m : Type v → Type w} [Monad m] {β : Type v} (t : 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 β)) :
PersistentArrayNode α → m (Option β)
@[specialize #[]]
def Lean.PersistentArray.findSomeRevM? {α : Type u} {m : Type v → Type w} [Monad m] {β : Type v} (t : 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 #[]]
partial def Lean.PersistentArray.forMAux {α : Type u} {m : Type v → Type w} [Monad m] (f : α → m PUnit) :
PersistentArrayNode α → m PUnit
@[specialize #[]]
def Lean.PersistentArray.forMFrom0 {α : Type u} {m : Type v → Type w} [Monad m] (t : PersistentArray α) (f : α → m PUnit) :
m PUnit
Equations
- t.forMFrom0 f = Lean.PersistentArray.forMAux f t.root *> Array.forM f t.tail
Instances For
@[specialize #[]]
def Lean.PersistentArray.forM {α : Type u} {m : Type v → Type w} [Monad m] (t : PersistentArray α) (f : α → m PUnit) (start : Nat := 0) :
m PUnit
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def Lean.PersistentArray.foldr {α : Type u} {β : Type u_1} (t : PersistentArray α) (f : α → β → β) (init : β) :
β
Instances For
@[inline]
Equations
Instances For
Instances For
Instances For
@[instance_reducible]
Equations
@[inline]
def Lean.PersistentArray.findSome? {α : Type u} {β : Type u_1} (t : PersistentArray α) (f : α → Option β) :
Option β
Equations
- t.findSome? f = (t.findSomeM? fun (x : α) => pure (f x)).run
Instances For
@[inline]
def Lean.PersistentArray.findSomeRev? {α : Type u} {β : Type u_1} (t : PersistentArray α) (f : α → Option β) :
Option β
Equations
- t.findSomeRev? f = (t.findSomeRevM? fun (x : α) => pure (f x)).run
Instances For
@[specialize #[]]
partial def Lean.PersistentArray.anyMAux {α : Type u} {m : Type → Type w} [Monad m] (p : α → m Bool) :
PersistentArrayNode α → m Bool
@[specialize #[]]
def Lean.PersistentArray.anyM {α : Type u} {m : Type → Type w} [Monad m] (t : PersistentArray α) (p : α → m Bool) :
m Bool
Equations
- t.anyM p = (Lean.PersistentArray.anyMAux p t.root <||> Array.anyM p t.tail)
Instances For
@[specialize #[]]
partial def Lean.PersistentArray.mapMAux {α : Type u} {m : Type u → Type v} [Monad m] {β : Type u} (f : α → m β) :
PersistentArrayNode α → m (PersistentArrayNode β)
@[specialize #[]]
def Lean.PersistentArray.mapM {α : Type u} {m : Type u → Type v} [Monad m] {β : Type u} (f : α → m β) (t : PersistentArray α) :
m (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 (fun (x : α) => pure (f x)) t).run
Instances For
partial def Lean.PersistentArray.collectStats {α : Type u} :
PersistentArrayNode α → Stats → Nat → Stats
Equations
Instances For
@[instance_reducible]
Equations
Equations
- Lean.mkPersistentArray n v = n.fold (fun (x : Nat) (x_1 : x < n) (p : Lean.PArray α) => Lean.PersistentArray.push p v) Lean.PersistentArray.empty
Instances For
Converts a list to a persistent array.
Equations
Instances For
Equations
- Lean.Array.toPArray' xs = Array.foldl (fun (p : Lean.PersistentArray α) (x : α) => p.push x) Lean.PersistentArray.empty xs