Skip to content

Feature request: sets as canonical strings, to use as table keys #19

Description

@JDLH

It would be lovely if this module defined a canonical string form of sets, with seamless conversion between this form and the table form which works with set operators. My use case is using sets as table keys. e.g. if S1 is set {"a", "b"} and S2 is set {"b", "c"}, then you could define a table {S1=10, S2=20}. This doesn't work with the present table form of sets because of the way the Lua interpreter defines equality of tables; see #18.

Stack Overflow question, Use a table's content as a key has a question about using sets as table keys, and a comment to one of the answers has a valuable insight as to how the current implementation doesn't work well, because it stores sets with set member names instead of consecutive integers as keys.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions