Multik 0.3.0 Help

drop

Returns a new 1D array with leading elements removed. drop(n) removes the first n elements, while dropWhile removes elements from the front as long as they satisfy the given predicate. Both functions are available only on 1D arrays.

Signatures

fun <T> MultiArray<T, D1>.drop(n: Int): D1Array<T> inline fun <T> MultiArray<T, D1>.dropWhile( predicate: (T) -> Boolean ): NDArray<T, D1>

Parameters

Parameter

Type

Description

n

Int

Number of elements to drop from the beginning.

predicate

(T) -> Boolean

Drop elements while this condition holds.

Returns: D1Array<T> — a new 1D array without the dropped elements.

Example

val a = mk.ndarray(mk[1, 2, 3, 4, 5]) a.drop(2) // [3, 4, 5] a.dropWhile { it < 3 } // [3, 4, 5]
28 February 2026