From: "Peña, Botp" Date: 2007-06-08T11:38:12+09:00 Subject: Re: What about a 'series' type? On Behalf Of Peter Marsh: # [2,6,18,54] series. So I suggest this: # arithmetic_series = Arith.new(First_Term,Common_Difference) nice, but i am poor in english, and there are too many words in ruby already. i'd propose extending Range a bit (i hope), like Range.new(start, end, exclusive=false, diff=&:succ) where diff could be &:succ where next term is succ this is the current implem &:pred where next term is pred (succ==pred) this has the effect of defining a reverse range ("z".."x")==("x".."z").reverse == Range.new("z".."x",,&:pred) "z".succ => "y" "y".succ => "x" eg, r=Range.new("z","x",,&:pred) r.each{|x| p x} => z y x &:+n where next term is term+n &:-n where next term is term-n eg, r=Range.new(100,96,,&:-2) r.each{|x| p x} => 100 98 96 &:*n where next term is term*n &:/n where next term is term/n {blck} where {blck} is a code block where {block} defines next/succ eg, r=Range.new("0a","zz",) do |x| case when x=="0z" "aa" else x.succ end end r.each{|x| p x} => 0a 0b.. 0z aa ab ..yz zz or something like that to that effect..