Acme-Siteswap
view release on metacpan or search on metacpan
lib/Acme/Siteswap.pm view on Meta::CPAN
# reduce returns the first element, so correct for
# that here
$max_throw = max(@$max_throw) if ref $max_throw eq 'ARRAY';
return $max_throw;
}
# extend the pattern by the number of throws equal to the biggest
# throw in the pattern, to ensure that every throw in the pattern
# lands at least once.
sub _expand_throws {
my ($throws) = @_;
my $max_throw = _max_throw($throws);
foreach my $i (0 .. $max_throw) {
# if it's a multiplex throw, we want to copy it
my $t = ref $throws->[$i] eq 'ARRAY' ? [@{$throws->[$i]}]
: $throws->[$i];
push @$throws, $t;
}
return $throws;
( run in 3.637 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )