From: Travis Whitton Date: 2003-02-21T01:18:49+09:00 Subject: Re: optimization question > Bulat is suggesting that we introduce the methods Array#uniqc and > Array#to_hash. > > I agree with him. He does have a point that his algorithm was better, and > my program was only faster because it was in C. I'll come back to this > this afternoon to see if I can write those to methods. I omitted an important detail in my original post. The hash needs to retain state for every line of the file, i.e., hash = Hash.new(0) fh.each do |data| data.scan(iptok).each do |tok| hash[tok] = hash[tok].succ end end return hash In order to make this work, the filter you wrote would need to save it's hashes state internally. I suppose this would mean it would need to be a class instead of a module. Anyway, thanks again! -Travis