From: Aaron Patterson Date: 2007-11-12T12:23:46+09:00 Subject: Re: comp.lang.fortran challenge On Mon, Nov 12, 2007 at 12:20:32PM +0900, Aaron Patterson wrote: > On Mon, Nov 12, 2007 at 10:30:06AM +0900, Bil Kleb wrote: > > Having Ruby fun with the comp.lang.fortran folks: > > > > http://tinyurl.com/38o8ex > > http://tinyurl.com/2pw22q > > > > Please riff a better Ruby answer... > > I'm confused as to why the data needs to be retained in memory..... But > here is a little something I put together. It does maintain the > datastructures in memory before calculating the results. > > require 'open-uri' > > class PhilCollins > attr_writer :time > alias :time :time= > > def initialize(io) > @uv_by_t = Hash.new { |h,t| h[t] = Hash.new { |n,a| n[a] = [] } } > @time = 10 Oops. @time should be nil, but that shouldn't change the output.... -- Aaron Patterson http://tenderlovemaking.com/