Optional
start: numberOptional
end: numberimport { assertEquals } from "jsr:@std/assert"
// basic example
const arr1 = [1, 2, 3, 4, 5, 99, 88]
const arr1_diff = diff_right(arr1)
assertEquals(arr1_diff, [-1, -1, -1, -1, -94, 11])
// subarray slicing example
const arr2 = [1, 2, 3, 4, 5, 99, 88]
const arr2_diff = diff_right(arr2, 2, -1)
assertEquals(arr2_diff, [-1, -1, -94])
compute the right-to-left (ie reverse) running difference between preceding elements.
the returned array's length is decremented by one. as a result, a single element array will turn into an empty array.
be careful when using with unsigned typed arrays.