Skip to content
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

Set Equal with Map #39

Open
ColmBhandal opened this issue Jun 15, 2020 · 0 comments
Open

Set Equal with Map #39

ColmBhandal opened this issue Jun 15, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@ColmBhandal
Copy link
Owner

Requirement

Add a version of the setEquals method that takes a lambda for mapping elements of the sets before comparison. The idea is that the lambda should be used to map elements to a type that's inherently comparable. The methods should work as follows:

  • Two new sets of mapped values are generated
  • Those sets are compared using the regular setEquals method.

The method should be documented clearly to explain what it does. The documentation should clearly warn the user that the mapping function they pass to the method should be injective, in order for the result to be trustworthy. Injectivity, in general, can't be checked by code so this would be up to the user of the function.

Value Proposition

When comparing sets of complex types e.g. sets of arrays of tuples, the standard setEquals function is not powerful enough to determine when two sets are equal. Mapping to a simpler type which is comparable allows such complex sets to be compared.

@ColmBhandal ColmBhandal added the enhancement New feature or request label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant