subsetQ[set1_, set2_] := Intersection[set1, set2] == set1;Sort[set1];
lists = {{a, b, c}, {a, b, d}, {d, e}, {d}, {a}, {a, b}, {f}};
Select[lists, ! Or @@ Table[subsetQ[#, set],
{set, Complement[lists, {#}]}] &]
Seems to work even ifIf the elementslists are stringsnot ordered, however, then my subsetQ
wasn't working; should take order into account. This might fix it:
subsetQ[set1_, set2_] := Intersection[set1, set2] == set1;Sort[set1];
lists = Map[ToString{{"test", {"1"}, {a"test", b"1", c"1"}, {a"test", b"1", d"2"},
{d"test", e"1", "3"}, {d"test", "1", "4"}, {a"test", "1", "5"},
{a"test", b"2"}, {f"test", "2", "1"}, {"test", "2", "2"},
{2"test", "2", "3"}];};
Select[lists, !Or@@Table[subsetQ[# Or @@ Table[subsetQ[#, set], {set,
Complement[lists, {#}]}] &] // InputForm
(* Out: {{"a""test", "b""1", "c""1"}, {"a""test", "b""1", "d""3"}, {"d""test", "e""1", "4"},
{"f""test", "1", "5"}, {"test", "2", "2"}, {"test", "2", "3"}} *)
I still think we might get tens of thousands of views and hundreds of upvotes! I mean, this is an actual application.Is that what you're hoping for?