Lecture overview -- Keyboard shortcut: 'u'  Previous page: Example streams -- Keyboard shortcut: 'p'  Next page: Applications of The sieve of Eratosthenes -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Evaluation Order and Infinite Lists - slide 25 : 27

Stream example: The Sieve of Eratosthenes
The Sieve of Eratosthenes is a slightly more sophisticated example of the use of streams
(define (sieve stream)
   (cons-stream
     (head stream)
     (sieve 
       (filter-stream
         (lambda (x) (not (divisible? x (head stream))))
         (tail stream)))))