On Nov 19, 2005, at 9:48, David Landgren wrote:

And Xavier Noria did write:

On Nov 17, 2005, at 22:45, David Landgren wrote:
People,

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).
There are some modules dealing with this kind of stuff, with more generic interfaces. For instance Math::Combinatorics or Algorithm::Combinatorics.

I've had a long look at Math::Combinatorics, and while it could be used to generate a power set, it would take a certain amount of make-work code.

Well, with Algorithm::Combinatorics, which I know better, you'd just do:

    my @power_set = ();
    push @power_set, combinations([EMAIL PROTECTED], $_) for [EMAIL PROTECTED];

Not that much amount of code. And of course includes de empty list.

The power set is not offered directly by the module because this is a work in progress and I want to be sure the interface evolves in a consistent way. I am not 100% sure yet the power set fits there as such.

Plus, the documentation is awful, and there are no examples to try out.

I agree there, it was one of the triggers that made me start writing Algorithm::Combinatorics. I didn't like the interface and the documentation, plus I wanted something in XS for the core loops.

-- fxn

Reply via email to