-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SortedSet confusion with keys that sort (but not compare) the same #528
Comments
Defining an equality comparison is not necessary (and does not change the behavior in the last paragraph), but may improve performance as noted in the docs. However, the equality comparison must be consistent with the lt comparison. In other words, it must be the case that |
It wasn't to me because even though the keys have the same ordering, isequal/== returned false. Of course, I don't have experience with how SortedDict is implemented, so it probably makes sense.
I suspected as much, but missed it in the docs... Thanks for the quick response! |
I can try to improve the docs on this topic, but I'm not sure how. I see some of the docs in-line with the code, other docs in the github directory docs/src, and then there is also documentation on github.io linked from the data structures home page that has a link labeled "edit on github". Could someone who understands how the docs are laid out explain the correct way to create a PR for documentation corrections? |
Closed via #787 |
I'm having some issues with
SortedSet
. Reading the docs, I came up with the following:So when using this ordering, for which two objects
a
andb
sort identically, theSortedSet
overwritesa
when insertingb
... This seems counter-intuitive, and not mentioned in the docs?Anyhow, on a second read-through I noticed some details I missed (but IIUC do not explain the above) about
Base.lt
andDataStructures.eq
, so I tried tweaking my comparator to have a proper egality function:This seems even worse, especially I can actually get
a
andb
by iterating the set!Did I confuse
SortedSet
by defining an invalid comparator? Either way, maybe I've missed something but I think the docs could use some elaboration here.The text was updated successfully, but these errors were encountered: