You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:
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.
The text was updated successfully, but these errors were encountered: