Multik 0.3.0 Help

asSequence

Wraps the array into a lazy Sequence<T> that yields elements in row-major order on demand. Use it when chaining multiple operations to avoid creating intermediate arrays.

Signature

fun <T, D : Dimension> MultiArray<T, D>.asSequence(): Sequence<T>

Returns: A Sequence<T> that yields elements lazily in row-major order.

Example

val a = mk.ndarray(mk[mk[1, 2, 3], mk[4, 5, 6]]) val result = a.asSequence() .filter { it > 2 } .map { it * 10 } .toList() // [30, 40, 50, 60]
28 February 2026