Name
Math::Permute::Lists - Generate all the permutations of zero or more nested lists.
Synopsis
use Math::Permute::Lists;
permute {say "@_"} [1,2],[3,4];
# 1 2 3 4
# 1 2 4 3
# 2 1 3 4
# 2 1 4 3
# 3 4 1 2
# 3 4 2 1
# 4 3 1 2
# 4 3 2 1
permute {say "@_"} 1,[2,[3,4]];
# 1 2 3 4
# 1 2 4 3
# 1 3 4 2
# 1 4 3 2
# 2 3 4 1
# 2 4 3 1
# 3 4 2 1
# 4 3 2 1
Description
Generate all the permutations of zero or more nested lists using the standard Perl metaphor.
permute()
returns the number of permutations in both scalar and array context.
permute()
is 100% Pure Perl.
Export
The permute()
function is exported.
Installation
Standard Module::Build process for building and installing modules:
perl Build.PL
./Build
./Build test
./Build install
Or, if you're on a platform (like DOS or Windows) that doesn't require the "./" notation, you can do this:
perl Build.PL
Build
Build test
Build install
Author
PhilipRBrenan@appaapps.com
http://www.appaapps.com
Acknowledgements
From a suggestion by Philipp Rumpf.
See Also
- Math::Cartesian::Product
- Math::Disarrange::List
- Math::Permute::List
- Math::Subsets::List
- Algorithm::Permute
- Algorithm::FastPermute
Copyright
Copyright (c) 2009 Philip R Brenan.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.