On Nov 23, 2005, at 9:06 AM, David A. Black wrote: > You could define an appropriate default behavior for the hash of > hashes: > > unique_hashes = Hash.new do |hash,key| > existing = hash.keys.find {|k| k == key } > if existing > hash[existing] += 1 > else > hash[key] = 1 > end > end This is a cool idea (and taught me about the block approach to creating hashes, thanks!). The one (seeming) flaw is the hash.keys.find, which would do an O(n) search on the hash.keys array, giving O(n) instead of a hash's normal O(ln(n)) behavior. Am I wrong about that? steve