m = DeleteDuplicates[Map[Sort, Tuples[{a, b, c, d}, 3]]];
DeleteCases[m, {OrderlessPatternSequence[_, b, b] |
OrderlessPatternSequence[_, c, c] | OrderlessPatternSequence[_, d, d]}]
(*{{a, a, a}, {a, a, b}, {a, a, c}, {a, a, d}, {a, b, c}, {a, b, d}, {a,c,d},{b, c, d}}*)
(* adopting Wizard's approach *)
DeleteCases[m, {OrderlessPatternSequence[x : b | c | d, x_, _] }]
(*{{a, a, a}, {a, a, b}, {a, a, c}, {a, a, d}, {a, b, c}, {a, b, d}, {a,c,d}, {b, c, d}}*)
Ali Hashmi
- 9.1k
- 4
- 22
- 43