Oleg, Thanks for this! I've attempted to rewrite this in terms of your monadic version of delimited continuations, as included in the pa_monad syntax extension distribution. I'm attaching my effort so far, which I have run in an OCaml 3.09.3 toploop in which I've done: #use "topfind";; #camlp4o;; #require "monad";; #load "cc.cmo";; I'm having some difficulty, I think, due to stream_req being a recursive type that I need to turn into a type that sometimes represents a computation that returns the (recursive) type. Any advice you (or others) might have would be most welcome. Many thanks and best regards, Paul Snively