Next refresh should show more results. ( run in 2.281 )
view release on metacpan or search on metacpan
lib/Guard/Timer.pm view on Meta::CPAN
use Carp;
use Time::HiRes qw/ gettimeofday tv_interval /;
use Guard;
sub timer_guard(&;$) { ## no critic(ProhibitSubroutinePrototypes)
my ($subref, $decimal_points) = @_;
$decimal_points ||= 3;
$decimal_points =~ /\A\d+\Z/
or croak("timer_guard: Number of decimal points isn't an integer");
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MARC/Loop.pm view on Meta::CPAN
use vars qw($VERSION @ISA @EXPORT_OK);
$VERSION = '0.01';
sub marcloop(&;$%);
use constant TAG => 0;
use constant VALREF => 1;
use constant DELETE => 2;
use constant IND1 => 3;
lib/MARC/Loop.pm view on Meta::CPAN
use constant SUBFIELD_DELIMITER => "\x1f";
@ISA = qw(Exporter);
@EXPORT_OK = qw(marcloop marcparse marcfield marcindicators marcbuild TAG VALREF DELETE IND1 IND2 SUBS SUB_ID SUB_VALREF RECORD_TERMINATOR FIELD_TERMINATOR SUBFIELD_DELIMITER);
sub marcloop(&;$%) {
my ($sub, $f, %arg) = @_;
my $fh;
$arg{'print'} = 1 if $arg{'print_all'};
my (%drop, %only);
if ($arg{'drop'}) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MDK/Common/DataStructure.pm view on Meta::CPAN
sub uniq { my %l; $l{$_} = 1 foreach @_; grep { delete $l{$_} } @_ }
sub difference2 { my %l; @l{@{$_[1]}} = (); grep { !exists $l{$_} } @{$_[0]} }
sub intersection { my (%l, @m); @l{@{shift @_}} = (); foreach (@_) { @m = grep { exists $l{$_} } @$_; %l = (); @l{@m} = () } keys %l }
sub uniq_(&@) {
my $f = shift;
my %l;
$l{$f->($_)} = 1 foreach @_;
grep { delete $l{$f->($_)} } @_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
example/mfor.pl view on Meta::CPAN
=pod
mfor [[ ] , [ ] ] { code expression };
=cut
=pod
sub mfor(&@);
sub mfor(&@) {
my $c_r = shift;
my $arrs = shift;
my $arr_lev = shift if ( @_ );
$arr_lev ||= 0;
view all matches for this distribution
view release on metacpan or search on metacpan
t/402-error-logged.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
sub warnextract(&) { ## no critic
my $code = shift;
my @warn;
local $SIG{__WARN__} = sub { push @warn, shift };
$code->();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mackerel/Webhook/Receiver/Declare.pm view on Meta::CPAN
use parent 'Exporter';
our @EXPORT = qw/receiver on/;
our $_RECEIVER;
sub receiver(&) {
my $code = shift;
local $_RECEIVER = Mackerel::Webhook::Receiver->new;
$code->();
$_RECEIVER;
}
view all matches for this distribution
view release on metacpan or search on metacpan
MsgStore.pm view on Meta::CPAN
{ print KEPT $_, "\t", $$kept{$_}, "\n"; }
close KEPT;
}
}
sub getmail(&;&)
{
my($prompt,$status)= @_;
$status= sub{} unless $status;
my $started= time;
my %kept; _getkept(%kept);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected, $name;
diag Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected, $name;
diag Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Maptastic.pm view on Meta::CPAN
=cut
# This function has been updated to include support for certain types
# of iterators
sub mapcar(&@)
{
my $sub= shift;
if( ! @_ ) {
croak( "mapcar: Nothing to map" );
}
lib/Maptastic.pm view on Meta::CPAN
`map_shift' (because with `shift', you get undef out if there was
nothing in the list).
=cut
sub mapcaru(&@)
{
my $sub= shift;
if( ! @_ ) {
croak( "mapcaru: nothing to map" );
}
lib/Maptastic.pm view on Meta::CPAN
for( my $i= 0; $i < $max; $i++ ) {
push @ret, &$sub( map { $_->[$i] } @_ );
}
return wantarray ? @ret : \@ret;
}
sub map_shift(&@) { goto \&mapcaru }
=item map_each { code } \%hash, \%hash, ...
"map_each" is a version of `map' that works on hashes. B<It does not
work like mapcar or mapcaru, it is a simple map for hashes>.
Supplying multiple hashes iterates over all of the hashes in sequence.
=cut
sub map_each(&@)
{
my $sub = shift;
if( ! @_ ) {
croak( "mapeach: Nothing to map" );
}
lib/Maptastic.pm view on Meta::CPAN
=back
=cut
sub imapcar(&@) {
die "imapcar not yet implemented";
}
sub imap_for (&@) { goto \&imapcar };
sub imap_foreach (&@) { goto \&imapcar };
lib/Maptastic.pm view on Meta::CPAN
# do something with each filename
}
=cut
sub filter(&@) {
my $sub = shift;
my @rv;
my @input = slurp @_;
while (@input) {
local($_) = shift @input;
lib/Maptastic.pm view on Meta::CPAN
# do something with each filename
}
=cut
sub ifilter(&@) {
my $sub = shift;
my $iter = iter(@_);
return bless sub {
my $val = $iter->();
lib/Maptastic.pm view on Meta::CPAN
Iterative `grep'
=cut
sub igrep(&@) {
my $sub = shift;
my $iter = iter @_;
return bless sub {
my $ok = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MarpaX/xPathLike.pm view on Meta::CPAN
#print 'operdata = ', Dumper $operData;
my @r = map {$types{$_}->()} grep {exists $types{$_}} keys %$operData;
return @r if wantarray();
return $r[0];
}
sub _naryOper(&$$;@){
my ($oper,$x,$y,@e) = @_;
$x = _operation($x) if ref $x;
$y = _operation($y) if ref $y;
my $res = $oper->($x,$y);
foreach my $e (@e){
$e = _operation($e) if ref $e;
$res = $oper->($res,$e);
}
return $res
}
sub _logicalOper(&$$){
my ($oper,$x,$y) = @_;
#print "x=", Dumper $x;
#print "y=", Dumper $y;
my @x = ($x);
my @y = ($y);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Cartesian/Product.pm view on Meta::CPAN
package Math::Cartesian::Product;
use Carp;
use strict;
sub cartesian(&@) # Generate the Cartesian product of zero or more lists
{my $s = shift; # Subroutine to call to process each element of the product
my @C = @_; # Lists to be multiplied
my @c = (); # Current element of Cartesian product
my @P = (); # Cartesian product
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Disarrange/List.pm view on Meta::CPAN
our $VERSION = '20170828'; # Monday 26 Jan 2015
use v5.8.0;
use warnings FATAL => qw(all);
use strict;
sub disarrange(&@) # Generate all the disarrangements of a list
{my $s = shift; # Subroutine to call to process each disarrangement
my $n = scalar(@_); # Size of array to be disarranged
# return 0 if $n < 2; # Require at least two elements to disarrange - per Philipp Rumpf
my $m = 0; # Number of disarrangements
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Function/Roots.pm view on Meta::CPAN
functions. Also, with a derivative near 0 the convergence is very
fast, regardless of initial guess.
=cut
sub fixed_point(&$;%){
my $g = shift;
my $guess = shift;
my %optional = @_;
my $E = $optional{epsilon} || $E;
my $Max_Iter = $optional{max_iter} || $Max_Iter;
lib/Math/Function/Roots.pm view on Meta::CPAN
algorithm. When the two guesses are near the solution however, this
algorithm gives rapid convergence.
=cut
sub secant(&$$;%){
my $f = shift;
my ($p0,$p1) = (shift,shift);
my %optional = @_;
my $E = $optional{epsilon} || $E;
lib/Math/Function/Roots.pm view on Meta::CPAN
the range, which (as in Bisection) is ensured by requiring that f(min)
and f(max) have opposite signs.
=cut
sub false_position(&$$;%){
my $f = shift;
my ($a,$b) = (shift,shift);
my %optional = @_;
my $E = $optional{epsilon} || $E;
lib/Math/Function/Roots.pm view on Meta::CPAN
you don't know anything about the function, give it a try without a
guess. Settings from epsilon and maximum iterations apply as normal.
=cut
sub find(&;$$%){
my $f = shift;
my ($a,$b);
# This is totally wrong, need to not assign to $a and $b when no
# arguments
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Groups.pm view on Meta::CPAN
}
orders($g); # Order if each element
1 # It is a group
}
sub Group(&@) # Create a group
{my $sub = shift; # Operator, elements
my $g = bless {&Elements=>{}, &Inverses=>{}, &Orders=>{}}; # Empty group
for my $a(@_) # Create multiplication table
{for my $b(@_)
{$g->{&Elements}{$a}{$b} = &$sub($a, $b);
lib/Math/Groups.pm view on Meta::CPAN
my %ðº = reverse %m; # Mapping between groups
keys(%m) == keys(%ðº) or confess "Please supply a bijective mapping!"; # Check that the mapping is bijective
$g->homoMorphic($ð´, %m) && $ð´->homoMorphic($g, %ðº) # Bijective homomorphism is an isomorphism
}
sub isoMorphisms(&$$) # Find all the isomorphisms between two groups
{my ($sub, $g, $ð´) = @_; # Sub to call to process found isomorphisms, first group, second group
ref($ð´) eq __PACKAGE__ or confess "Second parameter must be a group too!"; # Check it is a group
order($g) == order($ð´) or confess "Groups have different orders!"; # Check groups have same order
my $i = e($g); # Identity of first group
my $ð¶ = e($ð´); # Identity of second group
lib/Math/Groups.pm view on Meta::CPAN
sub autoMorphic($@) # Automorphic
{my $g = shift; # Group
$g->isoMorphic($g, @_) # Check
}
sub autoMorphisms(&$) # Find all the automorphisms of a group
{my ($sub, $g) = @_; # Sub to call to process found automorphisms, group
&isoMorphisms($sub,$g,$g)
}
# Export details
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# direction: (ð
-x, ð-y)
#
# The unit vectors d, ð± at right angles to ð are (-ðª, ð©) and (ðª, -ð©)
#-------------------------------------------------------------------------------
sub intersectionCircles(&$$$$$$)
{my ($sub, # Sub routine to process intersection
$x, $y, $r, # First circle centre, radius
$ð
, $ð, $ð¿) = @_; # Second circle centre, radius
@_ == 7 or confess "Wrong number of parameters";
return &$sub("Duplicate circles!") if # Complain if the two circles are in fact the same circle within the definition of nearness
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
#
# ð ethod: the area of a triangle is (base * height) / 2, the area of a slice is
# ð°ð¿ð¿/2 where ð° is the angle of a slice.
#-------------------------------------------------------------------------------
sub intersectionCirclesArea(&$$$$$$)
{my ($sub, # Sub routine to process area
$x, $y, $r, # First circle centre, radius
$ð
, $ð, $ð¿) = @_; # Second circle centre, radius
@_ == 7 or confess "Wrong number of parameters";
near($r) and confess "Radius of first circle is too small!";
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
#
# ð ethod: a circle with centre ð¹ through ð½ will intersect a circle with centre ð
# through ð½ at ð¾. ð° is then the average of ð½ and ð¾.
#-------------------------------------------------------------------------------
sub intersectionLinePoint(&$$$$$$)
{my ($sub, # Sub routine to process intersection
$ð
, $ð, $ð©, $ðª, # Two points on line ð¹
$x, $y) = @_; # The point ð½
@_ == 7 or confess "Wrong number of parameters";
near($ð
, $ð©) and near($ð, $ðª) and confess "Points on line are too close!"; # Line not well defined
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
my ($x, $y, $ð
, $ð) = @_;
&$sub(($x+$ð
) / 2, ($y+$ð) / 2) # Average intersection of intersection points
} $ð
, $ð, $ð¿, $ð©, $ðª, $ð£;
}
sub unsignedDistanceFromLineToPoint(&$$$$$$) # Unsigned distance from point to line
{my ($sub, $ð
, $ð, $ð©, $ðª, $x, $y) = @_; # Parameters are the same as for intersectionLinePoint()
@_ == 7 or confess "Wrong number of parameters";
intersectionLinePoint {&$sub(&vectorLength($x, $y, @_))} $ð
,$ð, $ð©,$ðª, $x,$y; # Distance from point to nearest point on line
}
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
#
# ð ethod: Let the closest point to point ð on line l be ð® and the closest point
# to point ð® on line L be ð¯. Lð®ð¯ is similar to Lð®ð°.
#-------------------------------------------------------------------------------
sub intersectionLines(&$$$$$$$$)
{my ($sub, # Sub routine to process intersection
$ð
, $ð, $ð©, $ðª, # Two points on line l
$ð«, $ð¬, $ð, $ð) = @_; # Two points on line L
@_ == 9 or confess "Wrong number of parameters";
near($ð
, $ð©) and near($ð, $ðª) and confess "Points on first line are too close!";
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# the base of said triangle. The centre of the base is the closest point on the
# line to the centre of the circle. The line is at right angles to the line from
# the centre of the circle to the centre of the base.
#-------------------------------------------------------------------------------
sub intersectionCircleLine(&$$$$$$$)
{my ($sub, # Sub routine to process intersection
$x, $y, $r, # Circle centre, radius
$ð
, $ð, $ð©, $ðª) = @_; # Line goes through these two points
@_ == 8 or confess "Wrong number of parameters";
near($ð
, $ð©) and near($ð, $ðª) and confess "Points on line are too close!";
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# and a line that passes through points: ($ð
, $ð) and ($ð©, $ðª).
# ðind: the area of the smallest lune as a fraction of the area of the circle
# ð ethod:
#-------------------------------------------------------------------------------
sub intersectionCircleLineArea(&$$$$$$$)
{my ($sub, # Sub routine to process area
$x, $y, $r, # Circle centre, radius
$ð
, $ð, $ð©, $ðª) = @_; # Line goes through these two points
@_ == 8 or confess "Wrong number of parameters";
near($ð
, $ð©) and near($ð, $ðª) and confess "Points on line are too close!";
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ðircumCentre: intersection of the sides of a triangle when rotated ð¿/2 at
# their mid points - centre of the circumCircle
# ðnown: coordinates of each corner of the triangle
#-------------------------------------------------------------------------------
sub circumCentre(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Corners are too close!";
&intersectionLines(sub{&$sub(@_)},
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ðnown: coordinates of each point
# ðind: coordinates of the centre and radius of the circle through these three
# points
#-------------------------------------------------------------------------------
sub circumCircle(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Points are too close!";
circumCentre
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ðnown: coordinates of each corner of the triangle
# ðind: centre coordinates and radius of inscribed circle
# ð ethod: find the intersection of the lines bisecting two angles
#-------------------------------------------------------------------------------
sub circleInscribedInTriangle(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Corners are too close!";
my $ð± = vectorLength($x, $y, $ð©, $ðª); # Lengths of sides opposite corners
my $ð = vectorLength($x, $y, $ð
, $ð);
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ðnown: coordinates of each corner of the triangle
# ðind: centre coordinates and radius of circle through midpoints
# ð ethod: use circumCircle on the midpoints
#-------------------------------------------------------------------------------
sub ninePointCircle(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Corners are too close!";
&circumCircle(sub{&$sub(@_)}, # Circle through mid points
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
#-------------------------------------------------------------------------------
# Bisect the first angle of a triangle
#-------------------------------------------------------------------------------
sub bisectAnAngle(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Corners are too close!";
my $ð = vectorLength($x, $y, $ð©, $ðª); # Lengths to opposite corners
my $ð± = vectorLength($x, $y, $ð
, $ð);
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# https://en.wikipedia.org/wiki/Incircle_and_excircles_of_a_triangle
# ðnown: coordinates of each corner of the triangle
# ð ethod: intersection of appropriate angles of the triangles
#-------------------------------------------------------------------------------
sub exCircles(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Corners are too close!";
my @c = &intersectionLines(sub{@_}, # Centres
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ðentroid: intersection of lines between corners and mid points of opposite sides
# ðind: coordinates of centroid
# ðnown: coordinates of each corner of the triangle
#-------------------------------------------------------------------------------
sub centroid(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Corners are too close!";
&intersectionLines(sub{&$sub(@_)},
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ð¢rthocentre: intersection of altitudes
# ðind: coordinates of orthocentre
# ðnown: coordinates of each corner of the triangle
#-------------------------------------------------------------------------------
sub orthoCentre(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
(near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª)) and confess "Corners are too close!";
&intersectionLines(sub{&$sub(@_)},
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ðnown: coordinates of each corner of the triangle
# ðind: area
# ð ethod: height of one corner from line through other two corners
#-------------------------------------------------------------------------------
sub areaOfTriangle(&$$$$$$)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª) = @_; # Subroutine to process results, coordinates of corners
@_ == 7 or confess "Wrong number of parameters";
return &$sub(0) if near($x, $ð
) && near($y, $ð) or near($ð
, $ð©) && near($ð, $ðª); # A pair of corners are close, so the area of the triangle must be zero
my ($d) = unsignedDistanceFromLineToPoint(sub {@_}, $ð
, $ð, $ð©, $ðª, $x, $y); # Distance for first corner from opposite line
&$sub($d * vectorLength($ð
, $ð, $ð©, $ðª)/2) # Area = half base * height
lib/Math/Intersection/Circle/Line.pm view on Meta::CPAN
# ðnown: coordinates of each corner=vertex of the polygon
# ðind: area
# ð ethod: divide the polygon into triangles which all share the first vertex
#-------------------------------------------------------------------------------
sub areaOfPolygon(&@)
{my ($sub, $x, $y, $ð
, $ð, $ð©, $ðª, @vertices) = @_; # Subroutine to process results, coordinates of vertices
my ($area) = areaOfTriangle {@_} $x, $y, $ð
, $ð, $ð©, $ðª; # Area of first triangle
for(;scalar @vertices;) # Each subsequent triangle
{($ð
, $ð) = ($ð©, $ðª); # Move up one vertex at a time
($ð©, $ðª) = splice @vertices, 0, 2; # Remove one vertex
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Permute/Array.pm view on Meta::CPAN
}
push @res, @array;
return \@res;
}
sub Apply_on_perms(&@)
{
my $func = shift;
my $array = shift;
return undef unless (defined $func and defined $array);
my $rest;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Permute/List.pm view on Meta::CPAN
use strict;
package Math::Permute::List;
sub permute(&@) # Generate all permutations of a list
{my $s = shift; # Subroutine to call to process each permutation
my $n = scalar(@_); # Size of array to be permuted
# return 0 unless $n; # Empty lists cannot be permuted - removed per Philipp Rumpf
my $l = 0; # Item being permuted
my @p = (); # Current permutations
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Permute/Lists.pm view on Meta::CPAN
our $VERSION = '20170828';
use v5.16.0;
use warnings FATAL => qw(all);
use strict;
sub permute(&@) # Generate permutations of lists - user interface
{my $s = shift; # Subroutine to call to process each permutation
&Permute($s, undef, @_); # Perform permutations
}
sub Permute # Generate and expand permutations - private
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Permute/Partitions.pm view on Meta::CPAN
package Math::Permute::Partitions;
use Math::Permute::List;
use Math::Cartesian::Product;
sub permutePartitions(&@) # Generate permutations of a partitioned list
{my $s = shift; # Subroutine to call to process each permutation
my @p; # Partitions
my $p = 0; # Current partitions
for(@_)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Prime/Util/PPFE.pm view on Meta::CPAN
}
}
_end_for_loop($oldforexit);
}
sub forcomposites(&$;$) { ## no critic qw(ProhibitSubroutinePrototypes)
Math::Prime::Util::_generic_forcomp_sub('composites', @_);
}
sub foroddcomposites(&$;$) { ## no critic qw(ProhibitSubroutinePrototypes)
Math::Prime::Util::_generic_forcomp_sub('oddcomposites', @_);
}
sub forsemiprimes(&$;$) { ## no critic qw(ProhibitSubroutinePrototypes)
Math::Prime::Util::_generic_forcomp_sub('semiprimes', @_);
}
sub forfactored(&$;$) { ## no critic qw(ProhibitSubroutinePrototypes)
Math::Prime::Util::_generic_forfac(0, @_);
}
sub forsquarefree(&$;$) { ## no critic qw(ProhibitSubroutinePrototypes)
Math::Prime::Util::_generic_forfac(1, @_);
}
sub fordivisors (&$) { ## no critic qw(ProhibitSubroutinePrototypes)
my($sub, $n) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Subsets/List.pm view on Meta::CPAN
package Math::Subsets::List;
use strict;
sub subsets(&@) # Generate all the subsets of a list
{my $s = shift; # Subroutine to call to process each subset
my $n = scalar(@_); # Size of list to be subsetted
my $l = 0; # Current item
my @p = (); # Current subset
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Transform/List.pm view on Meta::CPAN
# a b c d
# c d a b
=cut
sub transform(&$@) # Transform list
{my ($sub, $list, @trans) = @_; # Subroutine to process each transformation, list to be transformed, transformations
my $L = $list; # List to be transformed
ref($L) or die "transform(2): $L not a reference";
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Functions.pm view on Meta::CPAN
}
my $mocks = {};
sub method($) {@_}
sub methods($) {@_}
sub should(&) {@_}
sub mock {
Carp::croak 'useless use of mock with one or less parameter'
if scalar @_ < 2;
view all matches for this distribution
view release on metacpan or search on metacpan
maint-travis-ci/lib/tools.pm view on Meta::CPAN
$_[0] ||= 'META.json';
require CPAN::Meta;
return CPAN::Meta->load_file( $_[0] );
}
sub capture_stdout(&) {
require Capture::Tiny;
goto &Capture::Tiny::capture_stdout;
}
sub import {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
use Minecraft::SectionFilter;
use Term::ANSIColor qw( color );
my $sample = "§fhelloworld§4test§rdone";
sub safely(&) {
my $code = shift;
local $@;
my $failed = 1;
eval { $code->(); undef $failed };
if ($failed) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base.pm view on Meta::CPAN
ok $actual eq $expected,
$name . "\n" . Text::Diff::diff(\$expected, \$actual);
}
}
sub run(&;$) {
(my ($self), @_) = find_my_self(@_);
my $callback = shift;
for my $block (@{$self->block_list}) {
$block->run_filters unless $block->is_filtered;
&{$callback}($block);
view all matches for this distribution