[Proposal] Add MapSet.intersect?/2 to check for set intersection

69 views
Skip to first unread message

Parker Selbert

unread,
Jul 13, 2017, 10:45:00 AM7/13/17
to elixir-lang-core
Recently I discovered an application bug that stemmed from the use of MapSet.subset?/2. The code was attempting to check whether there was any overlap between two sets, but the use of subset?/2 is order dependent. The solution was to use MapSet.disjoint?/2 and check if the result was false, but that was not obvious and feels backwards.

I'm proposing the addition of MapSet.intersect?/2, which will check whether two sets have any members in common. For larger sets the best case performance would be better than "not disjoint", and it would be a more obvious solution.

Thoughts?

— Parker

José Valim

unread,
Jul 13, 2017, 10:57:18 AM7/13/17
to elixir-l...@googlegroups.com
Sounds good to me, since it can be considerably cheaper than the options we have today.



José Valim
Skype: jv.ptec
Founder and Director of R&D

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/15f6857f-6f2e-49fe-ad2b-b214b2b12e98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Parker Selbert

unread,
Jul 13, 2017, 12:24:59 PM7/13/17
to elixir-l...@googlegroups.com

— Parker
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages