Diving into the world of hash tables
11–20 of 107 posts
Re: Diving into the world of hash tables
#12This was different back when you would pick something like an alist to store associations. There the implementation stared you in the face. Same for the times you had to implement your own hash table. I don't exactly yearn for those days. Though, I am curious if alists actually win in speed for a large number of smaller hash tables.
Re: Diving into the world of hash tables
#13Mods, can we get a title change? As I write this every comment is taking issue with the "underrated", which isn't claimed in the article.
Re: Diving into the world of hash tables
#14It's actually sets that are underrated. All languages should come with a reference implementation. Hashtables aka Maps aka Dictionaries aka Associative arrays are just fine.
Sets are just like hashes where the value is always "true" for each key.
Plus you may be able to optimize Set to use less space than Map.
Re: Diving into the world of hash tables
#15Re: Diving into the world of hash tables
#16It's actually sets that are underrated. All languages should come with a reference implementation. Hashtables aka Maps aka Dictionaries aka Associative arrays are just fine.
But I think you probably meant having and using set operations effectively in day to day tasks, as in "make 2 sets and do a set different operation" instead of "do a for loop on first hash check if it is in the second, then put results in an accumulator.
Another thing is to think about set of sets. Can that be useful sometimes? Implementing that is slightly trickier. You'd need to be able to get a hash of a set. Python has frozenset https://docs.python.org/3/library/stdtypes.html#frozenset. I've used those on occasion.
Then of course there is Erlang sofs (sets of sets) module. Stumbled on it by accident. Oh my, it comes complete with an introduction to set theory and relational algebra:
http://erlang.org/doc/man/sofs.html
It just struck me as so out of place with the rest of the standard library modules. Would like to know its history
Re: Diving into the world of hash tables
#17It's actually sets that are underrated. All languages should come with a reference implementation. Hashtables aka Maps aka Dictionaries aka Associative arrays are just fine.
Re: Diving into the world of hash tables
#18It's actually sets that are underrated. All languages should come with a reference implementation. Hashtables aka Maps aka Dictionaries aka Associative arrays are just fine.
Sets are just like hashes where the value is always "true" for each key.
With:
{'A': true, 'B': false}
you seem to be suggesting `B` is 'not in the set'. What's `C`?Re: Diving into the world of hash tables
#19Re: Diving into the world of hash tables
#20Edit: It's 100% clear now. Thanks for the great answers everyone!