From: "Mauricio Fernández" Date: 2004-10-11T06:55:13+09:00 Subject: Re: Putting some code out to DRY On Mon, Oct 11, 2004 at 04:25:30AM +0900, trans. (T. Onoma) wrote: > > Notice the three lines of duplication. Any ideas on DRYing this up? > > def each > seed = @start Am I the only one who sometimes does things resembling whatever = lambda do yield(seed) @skip.times { seed = seed.succ } break if @halt.call(seed) if @halt end and then whatever[] ?? > if @step > @step.times do > yield(seed) > @skip.times { seed = seed.succ } > break if @halt.call(seed) if @halt > end > else > loop do > yield(seed) > @skip.times { seed = seed.succ } > break if @halt.call(seed) if @halt > end > end > end > > Thanks, > T. > > > [CO2D] or [WET] ? > > -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com