chickadee » srfi-121 » make-range-generator

make-range-generator start #!optional end stepprocedure

Creates a generator of a sequence of numbers. The sequence begins with start, increases by step (default 1), and continues while the number is less than end, or forever if end is omitted. If both start and step are exact, it generates exact numbers; otherwise it generates inexact numbers. The exactness of end doesn't affect the exactness of the results.

(generator->list (make-range-generator 3) 4)
 ⇒ (3 4 5 6)
(generator->list (make-range-generator 3 8))
 ⇒ (3 4 5 6 7)
(generator->list (make-range-generator 3 8 2))
 ⇒ (3 5 7)