Equations
- Subarray.size s = s.stop - s.start
Equations
- Subarray.get s i = let_fun this := (_ : s.start + i.val < Array.size s.as); Array.get s.as { val := s.start + i.val, isLt := this }
@[inline]
Equations
- Subarray.getD s i v₀ = if h : i < Subarray.size s then Subarray.get s { val := i, isLt := h } else v₀
Equations
- Subarray.get! s i = Subarray.getD s i default
Equations
- Subarray.getOp self idx = Subarray.get! self idx
Equations
- Subarray.popFront s = if h : s.start < s.stop then { as := s.as, start := s.start + 1, stop := s.stop, h₁ := (_ : s.start + 1 ≤ s.stop), h₂ := (_ : s.stop ≤ Array.size s.as) } else s
@[inline]
unsafe def
Subarray.forInUnsafe
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(s : Subarray α)
(b : β)
(f : α → β → m (ForInStep β))
:
m β
Equations
- Subarray.forInUnsafe s b f = let sz := USize.ofNat s.stop; Subarray.forInUnsafe.loop s f sz (USize.ofNat s.start) b
@[implementedBy Subarray.forInUnsafe]
opaque
Subarray.forIn
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(s : Subarray α)
(b : β)
(f : α → β → m (ForInStep β))
:
m β
@[inline]
def
Subarray.foldlM
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(f : β → α → m β)
(init : β)
(as : Subarray α)
:
m β
Equations
- Subarray.foldlM f init as = Array.foldlM f init as.as as.start as.stop
@[inline]
def
Subarray.foldrM
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[inst : Monad m]
(f : α → β → m β)
(init : β)
(as : Subarray α)
:
m β
Equations
- Subarray.foldrM f init as = Array.foldrM f init as.as as.stop as.start
@[inline]
def
Subarray.anyM
{α : Type u}
{m : Type → Type w}
[inst : Monad m]
(p : α → m Bool)
(as : Subarray α)
:
m Bool
Equations
- Subarray.anyM p as = Array.anyM p as.as as.start as.stop
@[inline]
def
Subarray.allM
{α : Type u}
{m : Type → Type w}
[inst : Monad m]
(p : α → m Bool)
(as : Subarray α)
:
m Bool
Equations
- Subarray.allM p as = Array.allM p as.as as.start as.stop
@[inline]
def
Subarray.forM
{α : Type u}
{m : Type v → Type w}
[inst : Monad m]
(f : α → m PUnit)
(as : Subarray α)
:
m PUnit
Equations
- Subarray.forM f as = Array.forM f as.as as.start as.stop
@[inline]
def
Subarray.forRevM
{α : Type u}
{m : Type v → Type w}
[inst : Monad m]
(f : α → m PUnit)
(as : Subarray α)
:
m PUnit
Equations
- Subarray.forRevM f as = Array.forRevM f as.as as.stop as.start
@[inline]
Equations
- Subarray.foldl f init as = Id.run (Subarray.foldlM f init as)
@[inline]
Equations
- Subarray.foldr f init as = Id.run (Subarray.foldrM f init as)
@[inline]
Equations
- Subarray.any p as = Id.run (Subarray.anyM p as)
@[inline]
Equations
- Subarray.all p as = Id.run (Subarray.allM p as)
def
Array.toSubarray
{α : Type u}
(as : Array α)
(start : optParam Nat 0)
(stop : optParam Nat (Array.size as))
:
Subarray α
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Array.extract as start stop = Array.ofSubarray (Array.toSubarray as start stop)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
- instAppendSubarray = { append := fun x y => let a := Subarray.toArray x ++ Subarray.toArray y; Array.toSubarray a 0 (Array.size a) }
Equations
- instReprSubarray = { reprPrec := fun s x => repr (Subarray.toArray s) ++ Std.Format.text ".toSubarray" }
Equations
- instToStringSubarray = { toString := fun s => toString (Subarray.toArray s) }