Skip Menu |

This queue is for tickets about the Algorithm-Combinatorics CPAN distribution.

Report information
The Basics
Id: 84559
Status: open
Priority: 0/
Queue: Algorithm-Combinatorics

People
Owner: Nobody in particular
Requestors: justincase [...] yopmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Permutation over multiple input lists
I'm looking for a way to generate permutations of multiple input lists. Here's an example of what I'm looking for with two lists: my @kids = qw(bob sam kelly sally); my @toys = qw(top ball horn bell puppet); permute(\@kids, \@toys); --- bob top bob ball ... sam top sam ball ... A few searches show this is a desired feature in many different languages, but I can't find anything on CPAN that does this.
It looks like this is referencing a Cartesian product (also called cross product or set product). This was filed in 2013, and in the last 5 years it looks like a lot of modules have come out with this functionality. Algorithm::Combinatorics still doesn't have this (last release early 2012), but there are quite a few modules now: use ntheory qw/forsetproduct/; forsetproduct { say "@_" } [1,2,3],[qw/a b c/],[qw/@ $ !/]; use Set::Product qw/product/; product { say "@_" } [1,2,3],[qw/a b c/],[qw/@ $ !/]; use Math::Cartesian::Product; cartesian { say "@_" } [1,2,3],[qw/a b c/],[qw/@ $ !/]; use Algorithm::Loops qw/NestedLoops/; NestedLoops([[1,2,3],[qw/a b c/],[qw/@ $ !/]], sub { say "@_"; }); as well as iterators from Set::Scalar, Set::CrossProduct, Set::CrossProduct::Lazy, and List::Gen.
My fault, sorry, I haven't been doing Perl for years, and this module is in practice not being maintained. I am going to announce the distributions in my account can be taken over.