Re: NRE committed: PLEASE TEST

john roll wrote:
This is very close and I was trying to formulate something like it
but, well it was hard for me.  Is there a reason that you need the
first yield?  Why doesn't "coroutine" create the command by default,
why does it wait for the first yield call?  Also understand the
reasons for the "iota_1_5" command, as I called it the "token" to hold
the coroutine, but it feels in the way to me (awkward).

Everything's still experimental right now. This is very new after all.
But we can use other features to make this better...

namespace path tcl::unsupported
proc iota {start end} {
for {set i $start} {$i<=$end} {incr i} {yield $i}
return -code break
proc UNIQUE_NAME {} {return cor[incr ::COUNTER]}
proc makeIota {start end} {
set cmd [UNIQUE_NAME]
coroutine $cmd apply {args {yield;tailcall {*}$args}} \
iota $start $end
return $cmd

I'm not yet 100% satisfied with what I've written, but it does show
how you can wrap the unpleasantness of the current API.