rsplitAt method

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

Divides one slice into a slice and a remainder slice at an index from the end. The slice will contain all indices from [0, len - N) (excluding the index N itself) and the second slice will contain all indices from [len - N, len) (excluding the index len itself).

Implementation

(Slice<T>, Slice<T>) rsplitAt(int index) {
  assert(index >= 0 && index <= _end - _start, "Index out of bounds");
  return (
    Slice(_list, _start, _end - index),
    Slice(_list, _end - index, _end)
  );
}