I needed a function to compute a list containing the difference between adjacent entries in another list, as diff() does for an array in MATLAB.

I first wrote something using **makelist()** and found it very slow for large lists. I then rewrote the function using **rest() **and found it much faster:

Advertisements