Two sids of the same coin: coroutines and streams

Jos asked here:

It seems to me that in many cases the same problem can be solved (for an eager evaluater) both by coroutines and by streams. Both solutions very well show the structure of the principal algorithm as might have been written with a lazy evaluator in mind. Which approach would be preferred in terms of efficiency (time and memory). May be you would like to address other aspects as well. One reason that makes me tend to choose streams, is that the latter seem better suited to automatic code generation from purely lazy code.

To which Matthais replied here:

It is indeed a well-known fact that streams and coroutines are two sides of the same coin. Talcott’s 1986 dissertation is the earliest theoretical treatment that I know.

Which Jim clarified here:

I believe the reference is to Carolyn Talcott’s dissertation “The essence of Rum: A theory of intensional and extensional aspects of Lisp-type computation”. Stanford, 1986. Unfortunately this is not available online, as far as I know.

Leave a Reply

Your email address will not be published. Required fields are marked *