From: Hugh Sasse Staff Elec Eng Date: 2002-08-06T18:37:36+09:00 Subject: Re: Super-iterator? (long) On Tue, 6 Aug 2002, Hal E. Fulton wrote: > Here's an idea for you. I've worked on it a couple of days. [...] > 2. Sometimes I want to do things "alternately" (i.e., for every > other iteration). I think this is a specific case -- maybe you will want to do something every third/fifth iteration.... > > class IteratorVar [...] How about deleting odd? and even? and having: def mod?(x) @count_ % x == 0 end def mod(x) @count_ % x end the latter so you can pick out the value you want. Iterate round the clock and fire off lunch at mod(24)==13, etc.... > Someone else made this point about next updating count. I'd suggest next and next! to overcome this. > def inspect > @value.inspect > end Should there be an inspect that tells you about @count_ as well? HTH Hugh