Slices of UInt64Array #
Slices of UInt64Array: the type, reads, slice notation, iterators, folds and searches,
membership and equality, and collecting iterators into arrays.
The slice type #
Internal representation of UInt64Array.Slice.
- array : UInt64Array
The underlying array.
- start : Nat
The starting index of the slice (inclusive).
- stop : Nat
The ending index of the slice (exclusive).
The starting index is no later than the ending index.
The ending index is no later than the end of the array.
Instances For
The underlying array.
Equations
Instances For
The starting index of the slice (inclusive).
Equations
Instances For
The ending index of the slice (exclusive).
Equations
Instances For
The starting index is no later than the ending index.
The ending index is no later than the end of the array.
Reads #
The element at index i of the slice, counted from the start of the slice.
Instances For
Equations
- ScalarArray.UInt64Array.Slice.instGetElemNatUInt64LtSizeSliceData = { getElem := fun (s : ScalarArray.UInt64Array.Slice) (i : Nat) (h : i < Std.Slice.size s) => s.get i h }
The element at index i of the slice, or v₀ if i is out of bounds.
Instances For
The element at index i of the slice, or default if i is out of bounds.
Instances For
Removes the first element of the slice, if any.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The empty slice, copies and printing #
The empty slice, backed by an empty array.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- ScalarArray.UInt64Array.Slice.instEmptyCollection = { emptyCollection := ScalarArray.UInt64Array.Slice.empty }
Equations
The elements of the slice, copied into a new array with a single memmove.
Instances For
Prints the array and the bounds in slice notation, (ScalarArray.UInt64Array.mk #[...])[i...j],
which evaluates to an equal slice: slices are equal when their arrays and bounds are.
Equations
- One or more equations did not get rendered due to their size.
Equations
- ScalarArray.UInt64Array.Slice.instToString = { toString := fun (s : ScalarArray.UInt64Array.Slice) => toString s.copy }
Slice notation #
The slice of a from index start up to, but not including, stop. If start or stop are not
valid bounds, they are clamped to the size of a, and start is clamped to stop.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Arrays coerce to slices, which is free. Slices don't coerce back, since that copies.
Equations
- ScalarArray.UInt64Array.instCoeSlice = { coe := fun (x : ScalarArray.UInt64Array) => x.toSlice }
Equations
- ScalarArray.UInt64Array.instSliceableNatSlice_1 = { mkSlice := fun (a : ScalarArray.UInt64Array) (range : Std.Rco Nat) => a.toSlice range.lower range.upper }
Equations
- ScalarArray.UInt64Array.instSliceableNatSlice_2 = { mkSlice := fun (a : ScalarArray.UInt64Array) (range : Std.Rci Nat) => a.toSlice range.lower }
Equations
- ScalarArray.UInt64Array.instSliceableNatSlice_5 = { mkSlice := fun (a : ScalarArray.UInt64Array) (range : Std.Roi Nat) => a.toSlice (range.lower + 1) }
Equations
- ScalarArray.UInt64Array.instSliceableNatSlice_6 = { mkSlice := fun (a : ScalarArray.UInt64Array) (range : Std.Ric Nat) => a.toSlice 0 (range.upper + 1) }
Equations
- ScalarArray.UInt64Array.instSliceableNatSlice_7 = { mkSlice := fun (a : ScalarArray.UInt64Array) (range : Std.Rio Nat) => a.toSlice 0 range.upper }
Equations
- ScalarArray.UInt64Array.instSliceableNatSlice_8 = { mkSlice := fun (a : ScalarArray.UInt64Array) (x : Std.Rii Nat) => a.toSlice }
The slice of s from index start up to, but not including, stop, clamped like toSlice.
Equations
Instances For
Equations
- ScalarArray.UInt64Array.instSliceableSliceNat_1 = { mkSlice := fun (s : ScalarArray.UInt64Array.Slice) (range : Std.Rco Nat) => s.slice range.lower range.upper }
Equations
- ScalarArray.UInt64Array.instSliceableSliceNat_2 = { mkSlice := fun (s : ScalarArray.UInt64Array.Slice) (range : Std.Rci Nat) => s.slice range.lower }
Equations
- ScalarArray.UInt64Array.instSliceableSliceNat_5 = { mkSlice := fun (s : ScalarArray.UInt64Array.Slice) (range : Std.Roi Nat) => s.slice (range.lower + 1) }
Equations
- ScalarArray.UInt64Array.instSliceableSliceNat_6 = { mkSlice := fun (s : ScalarArray.UInt64Array.Slice) (range : Std.Ric Nat) => s.slice 0 (range.upper + 1) }
Equations
- ScalarArray.UInt64Array.instSliceableSliceNat_7 = { mkSlice := fun (s : ScalarArray.UInt64Array.Slice) (range : Std.Rio Nat) => s.slice 0 range.upper }
Equations
- ScalarArray.UInt64Array.instSliceableSliceNat_8 = { mkSlice := fun (s : ScalarArray.UInt64Array.Slice) (x : Std.Rii Nat) => s }
Iterators #
The iterator over the elements of a slice, used for for loops and the generic slice API.
- xs : UInt64Array.Slice
The rest of the slice.
Instances For
One step of the iterator: the first element of the rest of the slice, if there is one.
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.
The loop behind for loops and the Std.Iterators consumers on slices. Logically it is
Std.IteratorLoop.defaultImplementation, which steps the iterator one element at a time; it is
implemented by a loop over the USize indices of the underlying array.
Equations
- ScalarArray.UInt64Array.SliceIterator.forIn lift γ Pl it init f = Std.IteratorLoop.forIn lift γ Pl it init f
Instances For
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.
The elements that the slice iterator it has yet to yield, as a slice of the same array, without
copying. The start of the slice is the index of the next element in the array.
Equations
- it.toUInt64Slice = it.internalState.xs
Instances For
An iterator over the elements of a, for use with the Std.Iterators API.
Equations
- a.iter = Std.Slice.iter a.toSlice
Instances For
Folds and searches #
Folds a monadic function over the elements of s, from last to first.
Equations
- ScalarArray.UInt64Array.Slice.foldrM f init s = ScalarArray.UInt64Array.Slice.foldrM.loop f s (Std.Slice.size s) ⋯ init
Instances For
The loop of foldrM: folds f over the first i elements of s, from last to first.
Equations
- ScalarArray.UInt64Array.Slice.foldrM.loop f s 0 x_3 a = pure a
- ScalarArray.UInt64Array.Slice.foldrM.loop f s i_1.succ h a = do let __do_lift ← f s[i_1] a ScalarArray.UInt64Array.Slice.foldrM.loop f s i_1 ⋯ __do_lift
Instances For
For internal use only.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Folds a function over the elements of s, from last to first.
Equations
- ScalarArray.UInt64Array.Slice.foldr f init s = (ScalarArray.UInt64Array.Slice.foldrM (fun (x1 : UInt64) (x2 : β) => pure (f x1 x2)) init s).run
Instances For
Runs a monadic action on each element of s, from last to first.
Equations
- ScalarArray.UInt64Array.Slice.forRevM f s = ScalarArray.UInt64Array.Slice.foldrM (fun (x : UInt64) (x_1 : PUnit) => f x) PUnit.unit s
Instances For
The result of the last element of s for which f returns some, searching from the end.
Equations
Instances For
The loop of findSomeRevM?: searches the first i elements of s, from the end.
Equations
- One or more equations did not get rendered due to their size.
- ScalarArray.UInt64Array.Slice.findSomeRevM?.loop s f 0 x_2 = pure none
Instances For
For internal use only.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The last element of s that satisfies the monadic predicate p.
Equations
Instances For
The first element of s that satisfies p.
Equations
- s.find? p = (Std.Slice.iter s).find? p
Instances For
Whether some element of s satisfies p.
Equations
- s.any p = Std.Iter.any p (Std.Slice.iter s)
Instances For
Whether every element of s satisfies p.
Equations
- s.all p = Std.Iter.all p (Std.Slice.iter s)
Instances For
Whether some element of s is == to v.
Instances For
The number of elements of s that satisfy p.
Equations
Instances For
Membership and equality #
x ∈ s when x is an element of s.
Equations
- ScalarArray.UInt64Array.Slice.instMembershipUInt64 = { mem := fun (s : ScalarArray.UInt64Array.Slice) (x : UInt64) => x ∈ s.copy }
Compares the elements of two slices with ==: slices of different arrays, or at different offsets,
are equal when their elements are. Logically it compares the copies.
Instances For
For internal use only.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Collecting iterators into arrays #
Collects the values emitted by an iterator into a new array. Together with the Std.Iterators
combinators, this gives functions such as map, filter, take and zipWith, for example
(a.iter.map (· + 1)).toUInt64Array.
Equations
- it.toUInt64Array = Std.Iter.fold (fun (x1 : ScalarArray.UInt64Array) (x2 : UInt64) => x1.push x2) ScalarArray.UInt64Array.empty it
Instances For
Like Std.Iter.toUInt64Array, but the new array starts with room for capacity elements.
Equations
- it.toUInt64ArrayWithCapacity capacity = Std.Iter.fold (fun (x1 : ScalarArray.UInt64Array) (x2 : UInt64) => x1.push x2) (ScalarArray.UInt64Array.emptyWithCapacity capacity) it