Lecture overview -- Keyboard shortcut: 'u'  Previous page: Simulating Coroutines in Scheme -- Keyboard shortcut: 'p'  Next page: Simultaneous traversal of two binary trees (1) -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Simulation of other Paradigms and Continuations - slide 38 : 43

A simpel producer and consumer

We show two different variants of a simple producer consumer pattern

Producer Consumer - pure functional programming in Scheme.
Alternative Producer Consumer - the other coroutine is maintained in mutable state.

It is tricky to start up the two continuations

Explicit passing of continuations between the coroutines is clumsy - Keeping the continuation 'of the other part' in mutable state is an alternative