# SICP Solutions

### Chapter 4, Metalinguistic Abstraction

#### Exercise 4.73

For infinite streams, flatten-stream goes into infinite recursion without printing anything!

There’s a subtle difference between this infinite streams and in ex-4.71. When we combine the stream of streams using flatten-stream, then it might be the case we have infinite stream of finite(or infinite) streams. For such infinite stream of streams, we should be delaying else recursion with scheme’s applicative order evaluation will cause it to keep computing the infinite stream of streams!

It took me some time to come up with an example to demonstrate the situation for infinite stream of infinite stream. The example turned out to be quite simple.

Using the same rules which i used in ex-4.72:

Unlike the previous exercise, now i used and query instead of or query:

Why and?

Because and passes the stream of resulting frames from each clause to the next clause! or does not do so. So, if first clause can generate infinite frames, then we can produce the context required to demonstrate flatten-stream getting infinite stream of stream!