zena:fixed-array
import {…} from 'zena:fixed-array';
Classes
FixedArray
final extension class FixedArray<T> with IterableUtils<T> implements MutableArray<T>, Iterable<T>
new(length: i32, value: T)
length: i32
static from<A>(seq: Array<A>): FixedArray<A>
map<U>(f: (item: T, index: i32, seq: FixedArray<T>) => U): FixedArray<U>
fold<R>(initial: R, combine: (acc: R, item: T) => R): R
reverse(): FixedArray<T>
slice(start: i32, end: i32): FixedArray<T>
Returns a shallow copy of a portion of the array. The start index is inclusive, the end index is exclusive. Negative indices are not supported.
operator [](index: i32): T
operator []=(index: i32, value: T): void
operator [](r: BoundedRange): FixedArray<T>
Returns a slice of the array using BoundedRange (a..b).
operator [](r: FromRange): FixedArray<T>
Returns a slice from start to end of array (a..).
operator [](r: ToRange): FixedArray<T>
Returns a slice from beginning to end index (..b).
operator [](_r: FullRange): FixedArray<T>
Returns a copy of the entire array (..).
5 inherited members
Iterable
contains(value: T): boolean
Returns true if the collection contains the specified value.
all(predicate: (item: T) => boolean): boolean
Returns true if all elements match the given predicate. Returns true if the collection is empty.
some(predicate: (item: T) => boolean): boolean
Returns true if at least one element matches the given predicate. Returns false if the collection is empty.
find(predicate: (item: T) => boolean): inline (true, T) | inline (false, _)
Finds the first element that matches the predicate. Returns an inline tuple (true, item) if found, or (false, _) if not.
filter(predicate: (item: T) => boolean): Iterable<T>
Returns a new iterable containing only the elements that match the predicate.
Functions
fixed
function fixed<T>(items: FixedArray<T>): FixedArray<T>
Its argument, unchanged: fixed([1, 2, 3]).
The parameter supplies the mutable context, so a literal argument builds directly as a FixedArray — a mutable literal in expression position, where no annotation can say so. The identity body inlines away, leaving the bare allocation.