Are there any modules in Elixir for performing set operations?

Hy! Is there Any module in elixir which helps us in performing set operations?

  1. find Subset
  2. Find superset
  3. Find powerset etc

There is the MapSet module.

The MapSet.subset?/2 function can help you with the first 2 bulletpoints, though Iā€™m not quite sure what a powerset is.

2 Likes

I explored mapset but didnā€™t find powerset implementation.

I wrote a code for powerset in elixir and I want to contribute how can I contribute will you please help me out

As we are currently explaining in the slack to you, proposals that extend the standard library have to happen in the Core mailinglist.

Though due the ā€œcost of maintananceā€, it probably isnā€™t a proposal that would be accepted into the standard library and instead it would be better to create a library for your implementation and publish it on hex.

1 Like

What would a function that generates a power set of a given set be useful for? The size of the output grows very rapidly, and checking "is this set X in P(S)" is easier to implement by checking that every element of X is in S.

thanks for the awesome information.

I thought thatā€™s a fun exercise so I wrote a module for that:

3 Likes