March 22, 2004 - Categories: emacs
(defun sacha/total-difference (list) "Computes the sum of the differences between successive items in LIST." (let ((distance 0)) (while (cdr list) (setq distance (+ (abs (- (car list) (car (cdr list)))) distance)) (setq list (cdr list))) distance))
I used this to calculate the total distance travelled by a read/write
head given the list of tracks.