sicp-ex-3.53



<< Previous exercise (3.52) | Index | Next exercise (3.54) >>


 ;; s produces a stream of powers of 2, akin to the double stream example. 

Nue

 (define s (cons-stream 1 (add-streams s s))) 
  
 ;; this is the same as 
 (define s (cons-stream 1 (stream-scale 2 s))) 
  
 ;; which is the same as 
 (define s (cons-stream 1 (stream-scale 2 (cons-stream 1 (stream-scale 2 s))))) 
  
 ;; we're scaling by 2 repeatedly. its the powers of 2