Equations
- Subarray.size s = s.stop - s.start
Instances For
Equations
- Subarray.get s i = let_fun this := (_ : s.start + i.val < Array.size s.as); s.as[s.start + i.val]
Instances For
Equations
- Subarray.instGetElemSubarrayNatLtInstLTNatSize = { getElem := fun (xs : Subarray α) (i : Nat) (h : i < Subarray.size xs) => Subarray.get xs { val := i, isLt := h } }
@[inline]
Equations
- Subarray.getD s i v₀ = if h : i < Subarray.size s then Subarray.get s { val := i, isLt := h } else v₀
Instances For
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
Instances For
@[inline]
unsafe def
Subarray.forInUnsafe
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[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
Instances For
@[inline]
def
Subarray.foldlM
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[Monad m]
(f : β → α → m β)
(init : β)
(as : Subarray α)
:
m β
Equations
- Subarray.foldlM f init as = Array.foldlM f init as.as as.start as.stop
Instances For
@[inline]
def
Subarray.foldrM
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[Monad m]
(f : α → β → m β)
(init : β)
(as : Subarray α)
:
m β
Equations
- Subarray.foldrM f init as = Array.foldrM f init as.as as.stop as.start
Instances For
@[inline]
def
Subarray.anyM
{α : Type u}
{m : Type → Type w}
[Monad m]
(p : α → m Bool)
(as : Subarray α)
:
m Bool
Equations
- Subarray.anyM p as = Array.anyM p as.as as.start as.stop
Instances For
@[inline]
def
Subarray.allM
{α : Type u}
{m : Type → Type w}
[Monad m]
(p : α → m Bool)
(as : Subarray α)
:
m Bool
Equations
- Subarray.allM p as = Array.allM p as.as as.start as.stop
Instances For
@[inline]
def
Subarray.forM
{α : Type u}
{m : Type v → Type w}
[Monad m]
(f : α → m PUnit)
(as : Subarray α)
:
m PUnit
Equations
- Subarray.forM f as = Array.forM f as.as as.start as.stop
Instances For
@[inline]
def
Subarray.forRevM
{α : Type u}
{m : Type v → Type w}
[Monad m]
(f : α → m PUnit)
(as : Subarray α)
:
m PUnit
Equations
- Subarray.forRevM f as = Array.forRevM f as.as as.stop as.start
Instances For
@[inline]
def
Subarray.findSomeRevM?
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[Monad m]
(as : Subarray α)
(f : α → m (Option β))
:
m (Option β)
Equations
- Subarray.findSomeRevM? as f = Subarray.findSomeRevM?.find as f (Subarray.size as) (_ : Subarray.size as ≤ Subarray.size as)
Instances For
@[specialize #[]]
def
Subarray.findSomeRevM?.find
{α : Type u}
{β : Type v}
{m : Type v → Type w}
[Monad m]
(as : Subarray α)
(f : α → m (Option β))
(i : Nat)
:
i ≤ Subarray.size as → m (Option β)
Equations
- One or more equations did not get rendered due to their size.
- Subarray.findSomeRevM?.find as f 0 x_2 = pure none
Instances For
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.
Instances For
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
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
Equations
Instances For
Equations
- instAppendSubarray = { append := fun (x y : Subarray α) => let a := Subarray.toArray x ++ Subarray.toArray y; Array.toSubarray a 0 }
Equations
- instReprSubarray = { reprPrec := fun (s : Subarray α) (x : Nat) => repr (Subarray.toArray s) ++ Std.Format.text ".toSubarray" }
Equations
- instToStringSubarray = { toString := fun (s : Subarray α) => toString (Subarray.toArray s) }