splitSlice method

(Slice<T>, Slice<T>) splitSlice(
  1. int index
)

Divides array into two Slices at index from start. The first will contain all indices from [0, M) (excluding the index M itself) and the second will contain all indices from [M, N) (excluding the index N itself).

Implementation

(Slice<T>, Slice<T>) splitSlice(int index) {
  assert(index >= 0 && index <= list.length, "Index out of bounds");
  return (Slice(list, 0, index), Slice(list, index, list.length));
}