Set::CrossProduct

Set::CrossProduct is a Perl module that allows you to work with the cross product of two or more sets.
Download

Set::CrossProduct Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • brian d foy
  • Publisher web site:
  • http://search.cpan.org/~bdfoy/

Set::CrossProduct Tags


Set::CrossProduct Description

Set::CrossProduct is a Perl module that allows you to work with the cross product of two or more sets. Set::CrossProduct is a Perl module that allows you to work with the cross product of two or more sets.SYNOPSIS my $iterator = Set::CrossProduct->new( ARRAY_OF_ARRAYS ); # get the next tuple my $number_of_tuples = $iterator->cardinality; # get the next tuple my $tuple = $iterator->get; # move back one position my $tuple = $iterator->unget; # get the previous tuple without resetting # the cursor (peek at it) my $next_tuple = $iterator->next; # get the previous tuple without resetting # the cursor my $last_tuple = $iterator->previous; # get a random tuple my $tuple = $iterator->random; # in list context returns a list of all tuples my @tuples = $iterator->combinations; # in scalar context returns an array reference to all tuples my $tuples = $iterator->combinations;Given sets S(1), S(2), ..., S(k), each of cardinality n(1), n(2), ..., n(k) respectively, the cross product of the sets is the set CP of ordered tuples such that { | s1 => S(1), s2 => S(2), .... sk => S(k). }If you do not like that description, how about:Create a list by taking one item from each array, and do that for all possible ways that can be done, so that the first item in the list is always from the first array, the second item from the second array, and so on. Requirements: · Perl


Set::CrossProduct Related Software