This module implements an iterator for array slices (Subarray).
@[implicit_reducible, inline]
def SubarrayIterator.step {α : Type u} {m : Type u → Type u_1} :
Std.IterM Id α → Std.IterStep (Std.IterM m α) α
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
@[instance_reducible]
instance instIteratorLoopSubarrayIteratorIdOfMonad {α : Type u} {m : Type u_1 → Type u_2} [Monad m] :
@[instance_reducible, inline]
Equations
- Subarray.instToIterator = Std.ToIterator.of (SubarrayIterator α) fun (x : Std.Slice (Std.Slice.Internal.SubarrayData α)) => { internalState := { xs := x } }
@[instance_reducible]
Equations
Without defining the following function Subarray.foldlM, it is still possible to call
subarray.foldlM, which would be elaborated to Slice.foldlM (s := subarray). However, in order to
maximize backward compatibility and avoid confusion in the manual entry for Subarray, we
explicitly provide the wrapper function Subarray.foldlM for Slice.foldlM, providing a more
specific docstring.
@[inline]
def Subarray.forIn {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (s : Subarray α) (b : β) (f : α → β → m (ForInStep β)) :
m β
The implementation of ForIn.forIn for Subarray, which allows it to be used with for loops in
do-notation.
Instances For
Allocates a new array that contains the contents of the subarray.
Equations
- ↑s = Std.Slice.toArray s
Instances For
@[instance_reducible]
Equations
- instCoeSubarrayArray = { coe := Subarray.copy }
@[simp]
Allocates a new array that contains the contents of the subarray.
Equations
Instances For
@[instance_reducible]
Equations
- Array.instAppendSubarray = { append := fun (x y : Subarray α) => have a := Std.Slice.toArray x ++ Std.Slice.toArray y; a.toSubarray }
Subarray representation.
Equations
- Array.Subarray.repr s = repr (Std.Slice.toArray s) ++ Std.Format.text ".toSubarray"
Instances For
@[instance_reducible]
Equations
- Array.instReprSubarray = { reprPrec := fun (s : Subarray α) (x : Nat) => Array.Subarray.repr s }
@[instance_reducible]
Equations
- Array.instToStringSubarray = { toString := fun (s : Subarray α) => toString (Std.Slice.toArray s) }