#ruby-lang - Thu 29 Mar 2007 between 00:00 and 00:11

NY Lost Funds



LoganCapaldoi wish it had a good eql? and hash
like Array
teferime too
then Set would be ueful
pstickneis that going to change in upcoming?
LoganCapaldohmm
I just realized why
or part of the problem
Hash#eql? has to be O(n^2)
flgrdefault procs?
LoganCapaldothem too
no wait
no I'm still right
teferiare you sure?
I'm only counting O(n) assuming that lookups are O(1)
LoganCapaldohmm
ok
no i'm not right
I forgot about has_key?
teferifor each key in hash1, test to see if it's in hash2 and then compare the values
and also make sure that one hash isn't bigger than the other
LoganCapaldoyeah no
teferithat's O(n)
LoganCapaldoyou'e right as long as we have has_key?
teferiof course we have has_key?
it's one of the fundamental sodding hash operations
apeirosI'd compare keys first, then values. it's likely to perform better than do an iterative key-value comparison
LoganCapaldowell you could get away with not having it in ruby
teferiapeiros: it's still the same order of growth
apeirosOness won't change, though
teferiyeah
LoganCapaldountil you think about the {:a=>nil, :b=>nil} eql? {:q=>2, :w=>3} scenario
then you need it
teferiluckily, we have it
LoganCapaldoI hate nil
I vote we banish it from the language
xevoxLoganCapaldo, ?
why?
LoganCapaldowhy do I hate nil?
teferiLoganCapaldo: well, you could create your hash with a block that raises when you access an element that doesn't exist

Page: 2 9 16 23 30 

IrcArchive

NY Lost Funds