From: Jim Weirich Date: 2003-03-24T17:23:40+09:00 Subject: Re: Iteration styles (was Ruby lecture slides) On Mon, 2003-03-24 at 02:12, Paul Prescod wrote: > Yes, but the "for" loop doesn't know what you're doing so the syntax is > gross. Even moreso in Java than C++ IIRC. Yes, particularly because Java requires a cast everytime you call next(). > [...] The following code was grabbed from [Hipster's home > page], and he says that he got it from a ruby-talk post, so the original > author is unknown. Hmmm ... that code looks really familiar. I'll have to check the archives, but I'm ninety percent sure that was my example. Inline the do_generation method and drop the private and you end up with 21 lines of code ... my guess was pretty close. -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)