Note: This question is based on rethinking of my previous similar question.
I would like to know if Erlang's sofs:partition does the same thing which is described in Wikipedia's page about Set partitions.
If it does, how can I get the following result?
Given a data structure (a set of sets or a list of lists):
[a,b,c]
[a,b]
[c]
[d,e,f]
[d,f]
[e]
which contains the following unique elements:
a,b,c,d,e,f
the result of running the function with the argument N = 2
should be:
[[a,b,c], [d,e,f]]
While the following partitions should be filtered out in the process of executing sofs:partition
:
[[a,b,c], [d,f], [e]]
[[a,b], [c], [d,e,f]]
[[a,b], [c], [d,f], [e]]
Can I do this with sofs:partition? If yes, can I do it iteratively, throwing out the partitions of length(Partition) =/= N
during the execution? Is it possible to somehow redefine the sofs:partition
function to introduce the N argument?