lastChunk method

Option<Arr<T>> lastChunk(
  1. int n
)

Return an array with the last N items in the slice. If the slice is not at least N in length, this will return None.

Implementation

Option<Arr<T>> lastChunk(int n) {
  if (n > len()) {
    return None;
  }
  return Some(Arr.generate(n, (index) => _list[_end - n + index]));
}