-
Notifications
You must be signed in to change notification settings - Fork 37
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
keys and getindex of OrderedSet #97
Comments
Just realized that Julia actually converts |
Note that OrderSet is part of OrderedCollections, which is not this repository (DataStructures) but is adjacent. So I am closing this issue and requesting that you reopen it in OrderedCollections if you wish. |
OrderedCollections.jl/src/ordered_set.jl Lines 84 to 91 in 6497eb5
Personally I think getting rid of it is the right answer, but I know there have been voices to the contrary. |
My understanding of a set is a collection of keys without values. Therefore, I would expect
OrderedSet
to havekeys
as elements and their positions in the set as values or indices. This interpretation agrees with the description ofBase.getindex
: "Retrieve the value(s) stored at the given key or index within a collection."The current implementation of
getindex(ordered_set, i)
returns thei
th element inordered_set
which is opposite to this interpretation. I agree that it's useful to get the element at a given position, but it's more intuitive to useordered_set[i]
instead. Similarly, the current implementation ofkeys(ordered_set)
returns1:length(ordered_set)
instead ofcollect(ordered_set)
.The text was updated successfully, but these errors were encountered: