From: Joel VanderWerf Date: 2008-07-07T03:36:00+09:00 Subject: Re: implementing a simple and efficient index system Janus Bor wrote: > I could also save all processed id's as keys of a hash, however I don't > have any use for a value: > > sequences = {} > some kind of loop magic > if sequences[id] > process file > sequences[id] = true > end > end > > Would this method be more efficient? Is there a more elegant way? Also, > can Ruby handle arrays/hashes of this size? It's not so bad to use true as a hash value. But if it bothers you, there is the Set class, which is really a hash underneath, but the interface is set-membership rather than associative lookup: require 'set' s = Set.new s << 123 s << 456 p s.include?(456) # ==> true p s.include?(789) # ==> false -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407