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-fp.scm
Producer Consumer - pure functional programming in Scheme.
producer-consumer-non-fp.scm
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