Re: NRE committed: PLEASE TEST



Would this be close enough?

mig@cpq:/home/CVS/tcl_SF_clean/unix$ cat /tmp/iota.tcl
namespace path ::tcl::unsupported

proc iota { start end } {
yield
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 iota $start $end
return $cmd
}

set iota_1_5 [makeIota 1 5]

puts *[info command $iota_1_5]*
puts ---
while 1 {
set x [$iota_1_5]
puts $x
}
puts ---
puts *[info command $iota_1_5]*

mig@cpq:/home/CVS/tcl_SF_clean/unix$ ./tclsh /tmp/iota.tcl
*cor1*
---
1
2
3
4
5
---
**
mig@cpq:/home/CVS/tcl_SF_clean/unix$

.



Relevant Pages