Posted to tcl by aspect at Wed Jul 29 14:04:39 GMT 2015view pretty
# returns an unused procedure name proc gensym {prefix} { tailcall apply {{prefix} { string cat $prefix[llength [info commands $prefix*]] }} $prefix } # creates an anonymous coroutine proc go {cmd args} { set name [gensym goro#] coroutine $name $cmd {*}$args return $name }