Posted to tcl by miguel at Sun Apr 25 13:40:21 GMT 2010view pretty

% namespace eval tcl::unsupported namespace export yieldm
% namespace import tcl::unsupported::yieldm
% proc foo {} {while 1 {set r [yieldm]; puts "[llength $r]: $r"}}
% coroutine m foo
% m
0: 
% m "hi colin :)"
1: {hi colin :)}
% m 1 2 3
3: 1 2 3
% m hi colin :)
3: hi colin :)