A
Ara.T.Howard
this got a generally favourable reception so:
RCR - Numeric#of - an accumlative version of Numeric#times
~ > cat of.rb
class Numeric
def of
ret = []
times{|i| ret << yield(i)}
ret
end
end
them = 3.of{ Array.new }
p them # => [[],[],[]]
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| "640K ought to be enough for anybody." - Bill Gates, 1981
===============================================================================
RCR - Numeric#of - an accumlative version of Numeric#times
~ > cat of.rb
class Numeric
def of
ret = []
times{|i| ret << yield(i)}
ret
end
end
them = 3.of{ Array.new }
p them # => [[],[],[]]
-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| URL :: http://www.ngdc.noaa.gov/stp/
| "640K ought to be enough for anybody." - Bill Gates, 1981
===============================================================================