[plt-scheme] Doubt in stream-processing in Sec-3.5.2 of SICP

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Tue May 26 13:26:09 EDT 2009

Vinay Sachdev wrote at 05/26/2009 12:58 PM:
> I have a doubt in section Sec-3.5.2 of SICP. There is code to generate 
> sequence of integers using stream-processing.
> But if I run the above code in Dr Scheme with language set as "Pretty 
> Big" it runs into infinite loop.

In SICP, "cons-stream" is special syntax, not a procedure.  But that 
syntax is not defined in the Pretty Big language, so when you evaluate 
your code, Scheme tries to descend all the way through the infinite 
recursive applications of "integers-starting-from".  "cons-stream" is 
special syntax in SICP to prevent this.

The "SICP" language provides "cons-stream" syntax:  

It seems to work with your code:

Welcome to DrScheme, version 4.1.5 [3m].
Language: SICP (PLaneT 1.12); memory limit: 128 megabytes.
 > integers
(1 . #<promise>)


Posted on the users mailing list.