Skip to content

keys and getindex of OrderedSet #97

Open
@duanhuaiyu

Description

@duanhuaiyu

My understanding of a set is a collection of keys without values. Therefore, I would expect OrderedSet to have keys as elements and their positions in the set as values or indices. This interpretation agrees with the description of Base.getindex: "Retrieve the value(s) stored at the given key or index within a collection."

The current implementation of getindex(ordered_set, i) returns the ith element in ordered_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 use ordered_set[i] instead. Similarly, the current implementation of keys(ordered_set) returns 1:length(ordered_set) instead of collect(ordered_set).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions