function rangedPartialInsertionSort$<T, U=T>(x: T[], i: number, I: number, n: number, fc: CompareFunction<T|U>, fm: MapFunction<T, T|U>, fs: SwapFunction<T>): T[] {
  // NOTE: Insertion sort does not support partial sorting, so we ignore n.
  if (fs===swapRaw$) return rangedPartialInsertionSortSwapless$(x, i, I, n, fc, fm, fs);
  else               return rangedPartialInsertionSortSwap$    (x, i, I, n, fc, fm, fs);
}