Posted to tcl by colin at Mon May 24 09:16:47 GMT 2010view raw
- Nub domain /coco/ Coco lambda {r {
- set r [yield] ;# initially just redirect to this coroutine
- while {1} {
- # this coroutine loops around counting calls in $n
- set content [<h1> "Coco - Coroutining"]
- append content [<p> "You have called the coroutine [incr n] times."]
- set r [yield [Http Ok [Http NoCache $r] $content]]
- }
- }}