[erlang-questions] Bug in sets module? Equal sets aren't equal
Mon Feb 20 16:21:18 CET 2017
On Mon, Feb 20, 2017 at 03:32:56PM +0100, lenartlad@REDACTED wrote:
> What about this:
> sets:size(S1) == sets:size(S2) andalso sets:is_subset(S1, S2)
> This seems rather elegant, at least to me :-)
It was my fallback solution, too.
> Note however that I am not sure what the function sets:is_subset/2 returns for two empty sets (I do not have Erlang available at the moment to test it).
1> sets:is_subset(sets:new(), sets:new()).
so that edge case works, too.
> Ladislav Lenart
> > Od: "Alex S." <alex0player@REDACTED>
> > Komu: Hugo Mills <hugo@REDACTED>
> > Datum: 20.02.2017 15:11
> > Předmět: Re: [erlang-questions] Bug in sets module? Equal sets aren't equal
> > CC: <erlang-questions@REDACTED>
> >> 20 февр. 2017 г., в 16:58, Hugo Mills <hugo@REDACTED> написал(а):
> >> sets:from_list([[2, 2], [2, -2]]) =:= sets:from_list([[2, -2], [2, 2]]).
> >The onyl way to compare them for equality would be elementwise anyway, i.e. I'd roll with sets:to_list, it’s about as optimal as it gets.
> >erlang-questions mailing list
Hugo Mills | Great films about cricket: Umpire of the Rising Sun
hugo@REDACTED carfax.org.uk |
PGP: E2AB1DE4 |
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: Digital signature
More information about the erlang-questions