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 and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 3 - Page 21 : 42
Functional Programming in Scheme
Name binding, Recursion, Iteration, and Continuations
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))

The function number-interval from the general LAML library. This function returns a list of t-f+1 numbers from f to t .Try it out!.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/number-interval.scmThe function number-interval-iter is an iterative, tail recursive variant of number-interval.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/number-interval-dialogueA sample dialogue with the number interval functions.

Go to exerciseThe append function
Go to exerciseA list replication function