Re: NRE committed: PLEASE TEST
- From: miguel <msofer@xxxxxxxxxxxx>
- Date: Mon, 18 Aug 2008 12:39:08 -0300
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$
.
- Follow-Ups:
- Re: NRE committed: PLEASE TEST
- From: john roll
- Re: NRE committed: PLEASE TEST
- References:
- Re: NRE committed: PLEASE TEST
- From: john roll
- Re: NRE committed: PLEASE TEST
- Prev by Date: Re: TCL commands across multiple lines
- Next by Date: Tcl/Tk 8.5 vs iwidget 4.0.2
- Previous by thread: Re: NRE committed: PLEASE TEST
- Next by thread: Re: NRE committed: PLEASE TEST
- Index(es):
Relevant Pages
|