T. Onoma
1/14/2005 8:54:00 AM
On Friday 14 January 2005 02:06 am, "Peña, Botp" wrote:
| Hi,
|
| 1. I am a Integer#times fan :-) So you see my (and my kids) nuby codes
| littered w it. I have a small request though.
| Can we pass initial and step params?
|
| ie
|
| from int.times {|i| block }
|
| to int.times(starting=0, step=1) {|i| block }
|
| I hope this would not break old code, right?
|
|
| 2. my request may be handled by step. But I do not like step (me only);
| maybe because the sound does not ring or maybe because I do not like the
| order of params when read.
|
| iow
|
| from num.step(limit, step ) {|i| block },
|
| I prefer fr_num.step(step, upto ) {|i| block }
|
| since I would read the ff 1.step(2,5) {|x| p x} as
| "from 1 step 2 up to 5" (I know this would break old code)
|
| I feel Integer#upto has a better read -"int.upto(limit) {|i| block }", but
| sadly #upto has no steps either :(
|
| thanks for reading =)
|
| kind regards -botp
Whether these make it into Ruby core or not (I'm all for it) I will definitely
add these mods too Ruby Facets (unless of course someone can show that its a
really bad idea, but I doubt that). Do you have them coded up already by
chance?
Thanks,
T.