Le jeudi 17 novembre 2005 à 22:45, David Landgren écrivait: > > I have a simple module written and as far as I can tell, there's nothing > on CPAN that does this. (Algorithm::Permute might, but it segfaults on > my machine). > > From the POD: > > Data::SelectWithoutReplacement - Generate all subsets of a list of elements
What about Data::Subsets ? (and the empty list is a subset as well) There is a Set:: top-level namespace, but Set::Subsets sounds odd. > # prints > 3 1 4 > 1 4 > 3 4 > 4 > 3 1 > 1 > 3 Some people might like to receive the subsets ordered by size (ascending or descending) or maybe only a subset of the subsets (!). Like for instance, the 4 elements subsets of a 7 elements set. Specific arguments to the constructor could do the trick. -- Philippe "BooK" Bruhat Your reputation is what you make of it... and what you choose to take with you. (Moral from Groo The Wanderer #48 (Epic))