; arithmetic sequence
(define (seq? xs)
(let* ((mn (apply min xs))
(mx (apply max xs))
(len (length xs))
(diff (/ (- mx mn) (- len 1))))
(if (not (integer? diff)) #f
(= (* len (+ len 1) 1/2)
(apply +
(map (lambda (x)
(if (zero? (remainder x diff))
(quotient x diff)
0))
(map (lambda (x) (- x mn (- diff)))
xs)))))))
(display (seq? '(1 3 5 7 9))) (newline)
(display (seq? '(1 4 5 6 9))) (newline)