[plt-scheme] The place of streams?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Thu Jun 21 13:35:09 EDT 2007

> I wrote a function that iterates through a list prime numbers until a 
> predicate reports true.
> My first attempt involves generating the prime list up front, which 
> takes a lot of time.

Hi Grant,

There's a section in "Structure and Interpretation of Computer Programs" 
that explicitely uses this example.  You might want to take a peek at:


Later on in that chapter, they'll repeat this stream of primes example 
with a nifty stream version of the "sieve of Eratosthenes".

> It sounds like a stream could be used here, and I wouldn't need to 
> rewrite my function.

I think the only thing that might need a change is the use of FIRST/REST 
with the equivalent operations for streams.

Posted on the users mailing list.