From: Logan Capaldo Date: 2006-08-31T11:31:46+09:00 Subject: Re: [RCR] Array.step On Aug 30, 2006, at 10:22 PM, nobu@ruby-lang.org wrote: > Hi, > > At Thu, 31 Aug 2006 03:02:14 +0900, > Logan Capaldo wrote in [ruby-talk:211561]: >> I'd almost rather make the RCR for changing step rather than adding >> Array.step. It's more general, and with 1.9 magic iterators I think >> it would obviate the need to even have Array.step, e.g.: 1.step >> (3).to_a. Make n.step { ... } work as well and make it walk backwards >> if its from high to low. > > Do you mean this? > > $ ruby -v -e 'p 1.step(5,2).to_a' > ruby 1.9.0 (2006-08-29) [i686-linux] > [1, 3, 5] > Pretty much, except possibly supporting Ara's additional requirements of 9.step.to_a and 1.step(-2).to_a #=> [1, 0, -1, -2] > -- > Nobu Nakada >