[erlang-questions] Bug in sets module? Equal sets aren't equal

lenartlad <>
Mon Feb 20 15:32:56 CET 2017


Hello.

What about this:

sets:size(S1) == sets:size(S2) andalso sets:is_subset(S1, S2)

?

This seems rather elegant, at least to me :-)

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).

HTH,

Ladislav Lenart


______________________________________________________________
> Od: "Alex S." <>
> Komu: Hugo Mills <>
> Datum: 20.02.2017 15:11
> Předmět: Re: [erlang-questions] Bug in sets module? Equal sets aren't equal
>
> CC: <>
>
>> 20 февр. 2017 г., в 16:58, Hugo Mills <> написал(а):
>> 
>> 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
>
>http://erlang.org/mailman/listinfo/erlang-questions
>
>


More information about the erlang-questions mailing list