Result:
Your query is still running in background...Search in progress... at this time found 556 distributions and 696 files matching your query.
Next refresh should show more results. ( run in 2.281 )


Log-Timer

 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


Lux-IO

 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


MARC-Loop

 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


MDK-Common

 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


MFor

 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


MVC-Neaf

 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


Mackerel-Webhook-Receiver

 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


Mail-MsgStore

 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


Makefile-DOM

 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


Makefile-Parser

 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


Maptastic

 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


MarpaX-xPathLike

 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


Math-Cartesian-Product

 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


Math-Disarrange-List

 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


Math-Function-Roots

 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


Math-Groups

 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


Math-Intersection-Circle-Line

 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


Math-Permute-Array

 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


Math-Permute-List

 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


Math-Permute-Lists

 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


Math-Permute-Partitions

 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


Math-Prime-Util

 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


Math-Subsets-List

 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


Math-Transform-List

 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


MetaCPAN-API-Tiny

 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


MetaPOD-Format-JSON

 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


Method-Cached

 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


Minecraft-SectionFilter

 view release on metacpan or  search on metacpan

t/basic.t  view on Meta::CPAN

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


Mobile-Data-ITU

 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


Mobile-Data-SID

 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


( run in 2.281 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )