Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Recursion versus iteration -- Keyboard shortcut: 'p'  Next page: Examples of recursion: string-merge -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home      Name binding, Recursion, Iteration, and Continuations - slide 21 : 42

Example of recursion: number-interval
The function number-interval returns a list of integers from a lower bound to an upper bound
(define (number-interval f t)
 (if (<= f t)
     (cons f (number-interval (+ f 1) t))
    '()))
number-interval.scm
The function number-interval-iter is an iterative, tail recursive variant of number-interval.
number-interval-dialogue
A sample dialogue with the number interval functions.
Go to exercise
The append function
Go to exercise
A list replication function