Re: NRE committed: PLEASE TEST
- From: john roll <john@xxxxxxxxxx>
- Date: Sun, 17 Aug 2008 17:51:48 -0700 (PDT)
This is a very nice addition to tcl but its way to complex for me to
use. I need some sugar and I'm not sure how to write it. What I want
is a "generator" command which I can use to create different types of
generators, like iota:
generator iota { start end incr } {
for { set i $start } { $i <= $end } { incr $incr } { yield $i }
}
Then I might use it like this:
while { [set x [iota 2 20]] } { puts $x }
With the generator yielding 18 times and then returning "break". I
don't want to know about apply and other functional theory. I also
don't want to have to create a place holder token to hold the
coroutine. I know how I want to use coroutines and I don't want to
know all this other stuff.
Is an API like this possible?
.
- Follow-Ups:
- Re: NRE committed: PLEASE TEST
- From: miguel
- Re: NRE committed: PLEASE TEST
- Prev by Date: Can someone help me write a "yes-man" program
- Next by Date: Re: NRE committed: PLEASE TEST
- Previous by thread: Re: NRE committed: PLEASE TEST
- Next by thread: Re: NRE committed: PLEASE TEST
- Index(es):
Relevant Pages
|