The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Set::Product - generates the cartesian product of a set of lists

SYNOPSIS

    use Set::Product qw(product);

    product { say "@_" } [1..10], ['A'..'E'], ['u'..'z'];

DESCRIPTION

The Set::Product module generates the cartesian product of a set of lists.

FUNCTIONS

product

    product { BLOCK } \@array1, \@array2, ...

Evaluates BLOCK and sets @_ to each tuple in the cartesian product for the list of array references.

NOTES

If Set::Product::XS is installed, this module will automatically use it. You can prevent that and stick with the pure Perl version by setting the SET_PRODUCT_PP or PURE_PERL environment varible before using this module.

PERFORMANCE

This distribution contains a benchmarking script which compares several modules available on CPAN. These are the results on a MacBook 2.6GHz Core i5 (64-bit) with Perl 5.22.0:

    Set::Crossproduct          45.61+-0.3/s
    List::Gen                 60.75+-0.51/s
    Algorithm::Loops          68.32+-0.56/s
    Set::Scalar                100.8+-1.4/s
    Math::Cartesian::Product   203.2+-3.4/s
    Set::Product::PP           275.4+-1.3/s
    Set::Product::XS         724.96+-0.43/s

SEE ALSO

https://en.wikipedia.org/wiki/Cartesian_product

Set::Product::XS

Algorithm::Loops

List::Gen

Math::Cartesian::Product

Set::CrossProduct

Set::Product

Set::Scalar

REQUESTS AND BUGS

Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Set-Product. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Set::Product

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright (C) 2015 gray <gray at cpan.org>, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

gray, <gray at cpan.org>