From: Robert Klemme Date: 2004-05-04T21:49:02+09:00 Subject: Re: model for my problem (network simulator) "Gergely Kontra" schrieb im Newsbeitrag news:20040504121319.GA27180@mlabdial.hit.bme.hu... > On 0504, Robert Klemme wrote: > > The thing I find more interesting is the scheduling. This could be done > > like this (attached). > Hey! > I have almost the same code for scheduling. I just used something > similar to this. The only difference: I used relative time, so my method > is called after... Do you convert to abs time internally or how do you make sure the order is correct? > Maybe it worth to make something generally usable? => RAA > BTW > Hash.new {|h,k| h[k]= []} can be written as > Hash.new {[]} Nope, that's not the same: irb(main):001:0> h=Hash.new {[]} => {} irb(main):002:0> h[1] => [] irb(main):003:0> h => {} irb(main):004:0> h=Hash.new {|h,k| h[k]=[]} => {} irb(main):005:0> h[1] => [] irb(main):006:0> h => {1=>[]} irb(main):007:0> RUBY_VERSION => "1.8.1" Your solution makes the idiom "h[key] << something" unusable since all those arrays never make it into the hash. robert