Scheme Exercises

back to exercise list       previous     next

Group:     Exercise: 35/48 

Sequence:  Create a list -- an increasing sequence of integers

Create the function (sequence start end) where "start" and "end" are integers (not necessarily positive) with "start" less than or equal to "end". The result will be an increasing sequence of integers starting with "start" and ending with "end". For instance:
(sequence 1 5) ; -> (1 2 3 4 5)
(sequence -2 1) ; -> (-2 -1 0 1)
(sequence 5 5) ; -> (5)