; scheme
; http://xahlee.org/tree/tree.html
; Xah Lee, 2005-05
; code by Jussi Piitulainen jpiit...@ling.helsinki.fi
;;; Increasing list of b+ks in the interval [b..e) if s > 0.
;;; Decreasing list of b+ks in the interval (e..b] if s < 0.
(define (range b e s)
(do ((k (- (ceiling (/ (- e b) s)) 1) (- k 1))
(r '() (cons (+ b (* k s)) r)))
((< k 0) r)))
; test
(display (range 3 5 1/2))
; Note this code is very much incorrect.