3.51 Exercise 3.51
When we first define x, stream-map will call the show procedure on the first element of the stream, which will be forced immediately. No other values will be forced until the calling of (stream-ref x 5), which will only force enough to find the sixth element. We will then force two more when we call (stream-ref x 7). We can see this in action:
> (define x (stream-map show (stream-enumerate-interval 0 10)))
0
> (stream-ref x 5)
1
2
3
4
5
5
> (stream-ref x 7)
6
7
7