Xavier Noria wrote:
On May 22, 2006, at 20:14, Xavier Noria wrote:
That takes advantage of the fact that we want to divide a given set in
just two subsets of fixed size. A partitions generator may be added to
the module soon, but until then I think there's room for Set::Partition.
Indeed, I just uploaded to PAUSE Algorithm::Combinatorics 0.15 with
generators of partitions, and partitions of a given size.
To solve the original problem with these subroutines one generates
partitions of size 2 and filters out those whose subsets have size 1/4,
as in the session copied below.
[...code snipped...]
Nice.
I lacked the time to follow up on this originally. My original snippet
was perhaps too trivial.
The particular itch I wanted to scratch had four subsets, which would
require a certain amount (too much, IMHO) of make-work code for this
approach to be viable.
David
--
"It's overkill of course, but you can never have too much overkill."