I’m trying to find a function in a package or atleast a way to structure the code in order to to take the difference between each element in an array.

for example

x= (1 1 2 3 5 8 13 21)

*Note diff(x) is matlab’s*

y = diff(x)

output:

y = (0 1 1 2 3 5 8)