rsplitSlice method

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

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

Implementation

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