view release on metacpan or search on metacpan
lib/AI/MaxEntropy/Util.pm view on Meta::CPAN
qw/traverse_partially map_partially train_and_test precision recall/;
our %EXPORT_TAGS =
(all => [@EXPORT_OK]);
sub traverse_partially(&$$;$) {
my ($code, $samples, $pattern, $t) = @_;
$t ||= 'x';
my ($p, $n) = (length($pattern), scalar(@$samples));
for my $i (grep { substr($pattern, $_, 1) eq $t } (0 .. $p - 1)) {
for (int($n * $i / $p) .. int($n * ($i + 1) / $p) - 1) {
lib/AI/MaxEntropy/Util.pm view on Meta::CPAN
$code->();
}
}
}
sub map_partially(&$$;$) {
my ($code, $samples, $pattern, $t) = @_;
my @r;
traverse_partially { push @r, $code->($_) } $samples, $pattern, $t;
return \@r;
}
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
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
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
view release on metacpan or search on metacpan
lib/Acme/Lambda.pm view on Meta::CPAN
use base qw(Exporter);
our @EXPORT = qw(lambda λ);
our @EXPORT_OK = @EXPORT;
sub lambda(&) {
my $sub = shift;
return sub {local $_ = $_[0]; $sub->(@_)};
}
*λ = \λ
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/Acme/Perl/VM.pm view on Meta::CPAN
$PL_curcop = $old_cop;
return $retval;
}
sub run_block(&@){
my($code, @args) = @_;
if(APVM_DUMMY){
return $code->(@args);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/ProgressBar.pm view on Meta::CPAN
#pod simple progress bar indicating the time required for ten iterations through the
#pod code.
#pod
#pod =cut
sub progress(&) { ## no critic Prototype
my ($code) = @_;
local $| = 1; ## no critic
_overprint(_message(0,10,undef));
my $begun = Time::HiRes::time;
view all matches for this distribution
view release on metacpan or search on metacpan
# -*- Mode: Python -*-
# These are Pythonic ports of programs from MJD's HOP.
# Acme::Pythonic needs to know this prototype.
sub Iterator(&);
use Test::More 'no_plan';
use Acme::Pythonic debug => 0;
use strict
# Defined on page 122
sub NEXTVAL:
$_[0]->()
# Defined on page 123
sub Iterator(&):
return $_[0]
# Defined on page 160
sub imap(&$):
my ($transform, $it) = @_
return Iterator:
local $_ = NEXTVAL($it)
return unless defined $_
return $transform->()
while my $val = NEXTVAL($it):
push @$computed, $val
is_deeply $expected, $computed
# Defined on page 160
sub igrep(&$):
my ($is_interesting, $it) = @_
return Iterator:
local $_
while defined($_ = NEXTVAL($it)):
return $_ if $is_interesting->()
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/Rautavistic/Sort.pm view on Meta::CPAN
no warnings 'uninitialized';
my $last;
map { $_ ge $last ? $last = $_ : () } @_;
}
sub dropsortx(&@)
{
# magic variables $a and $b
use vars qw($a $b);
no strict 'refs';
no warnings 'uninitialized';
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
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
(This is equivalent to using C<< Future->call >>, but is duplicated here for
completeness).
=cut
sub call(&)
{
my ( $code ) = @_;
return Future->call( $code );
}
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
(This can be considered similar to C<call-with-escape-continuation> as found
in some Scheme implementations).
=cut
sub call_with_escape(&)
{
my ( $code ) = @_;
my $escape_f = Future->new;
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
# redo
undef $$trialp;
}
}
sub repeat(&@)
{
my $code = shift;
my %args = @_;
# This makes it easier to account for other conditions
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
Code that specifically wishes to catch failures in trial futures and retry
the block should use C<try_repeat> specifically.
=cut
sub try_repeat(&@)
{
# defeat prototype
&repeat( @_, try => 1 );
}
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
This function used to be called C<repeat_until_success>, and is currently
aliased as this name as well.
=cut
sub try_repeat_until_success(&@)
{
my $code = shift;
my %args = @_;
# TODO: maybe merge while/until conditions one day...
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
This function is also available under the name of simply C<fmap> to emphasise
its similarity to perl's C<map> keyword.
=cut
sub fmap_concat(&@)
{
my $code = shift;
my %args = @_;
_fmap( $code, %args, collect => "array" )->then( sub {
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
This function is also available under the shorter name of C<fmap1>.
=cut
sub fmap_scalar(&@)
{
my $code = shift;
my %args = @_;
_fmap( $code, %args, collect => "scalar" )
local/lib/perl5/Future/Utils.pm view on Meta::CPAN
This function is also available under the shorter name of C<fmap0>.
=cut
sub fmap_void(&@)
{
my $code = shift;
my %args = @_;
_fmap( $code, %args, collect => "void" )
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Format.pm view on Meta::CPAN
};
#@category ÐовÑÑки
# ÐовÑÑка Ð´Ð»Ñ STDERR
sub trapperr(&) {
my $sub = shift;
local *STDERR;
open STDERR, '>:utf8', \my $f;
$sub->();
close STDERR;
$f
}
# ÐовÑÑка Ð´Ð»Ñ STDOUT
sub trappout(&) {
my $sub = shift;
local *STDOUT;
open STDOUT, '>:utf8', \my $f;
$sub->();
close STDOUT;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Fs.pm view on Meta::CPAN
sub noenter(@) {
bless [@_], "Aion::Fs::noenter"
}
# ÐÑзÑваеÑÑÑ Ð´Ð»Ñ Ð²ÑеÑ
оÑибок ввода-вÑвода
sub errorenter(&) {
bless shift, "Aion::Fs::errorenter"
}
# ÐÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ find бÑдÑÑи вÑзван Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ из его ÑилÑÑÑов, errorenter или noenter
sub find_stop() {
die bless {}, "Aion::Fs::stop"
}
# ÐÑÐ¾Ð¸Ð·Ð²Ð¾Ð´Ð¸Ñ Ð·Ð°Ð¼ÐµÐ½Ñ Ð²Ð¾ вÑеÑ
ÑказаннÑÑ
ÑайлаÑ
. ÐозвÑаÑÐ°ÐµÑ ÑÐ°Ð¹Ð»Ñ Ð² коÑоÑÑÑ
замен не бÑло
sub replace(&@) {
my $fn = shift;
my @noreplace; local $_; my $pkg = caller;
my $aref = "${pkg}::a"; my $bref = "${pkg}::b";
for $$aref (@_) {
if(ref $$aref) { ($$aref, $$bref) = @$$aref } else { $$bref = ":utf8" }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Aion/Types.pm view on Meta::CPAN
}
}
}
sub as($) { (as => @_) }
sub init_where(&@) { (init_where => @_) }
sub where(&@) { (where => @_) }
sub awhere(&@) { (awhere => @_) }
sub message(&@) { (message => @_) }
sub SELF() { $Aion::Type::SELF }
sub ARGS() { wantarray? @{$Aion::Type::SELF->{args}}: $Aion::Type::SELF->{args} }
sub A() { $Aion::Type::SELF->{args}[0] }
sub B() { $Aion::Type::SELF->{args}[1] }
lib/Aion/Types.pm view on Meta::CPAN
push @{$type->{coerce}}, [$from, $via];
return;
}
sub from($) { (from => $_[0]) }
sub via(&) { (via => $_[0]) }
BEGIN {
subtype "Any";
subtype "Control", as &Any;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-base.t view on Meta::CPAN
DONE_TESTING:
done_testing;
# XXX temporary function
sub rand_between_ok(&$$) {
my ($block, $min, $max, $name) = @_;
my @res;
my %res;
for (1..30) {
my $res = $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
view release on metacpan or search on metacpan
lib/Algorithm/Loops.pm view on Meta::CPAN
}
die "$sub: ", @_, ".\n";
}
sub Filter(&@)
{
my( $code, @vals )= @_;
isa($code,"CODE") or _Croak(
"No code reference given" );
# local( $_ ); # Done by the loop.
lib/Algorithm/Loops.pm view on Meta::CPAN
}
wantarray ? @vals : join "", @vals;
}
sub MapCarE(&@)
{
my $sub= shift(@_);
isa($sub,"CODE") or _Croak(
"No code reference given" );
my $size= -1;
lib/Algorithm/Loops.pm view on Meta::CPAN
}
return wantarray ? @ret : \@ret;
}
sub MapCarMin(&@)
{
my $sub= shift(@_);
isa($sub,"CODE") or _Croak(
"No code reference given" );
my $min= -1;
lib/Algorithm/Loops.pm view on Meta::CPAN
}
return wantarray ? @ret : \@ret;
}
sub MapCarU(&@)
{
my $sub= shift(@_);
isa($sub,"CODE") or _Croak(
"No code reference given" );
my $max= 0;
lib/Algorithm/Loops.pm view on Meta::CPAN
}
return wantarray ? @ret : \@ret;
}
sub MapCar(&@)
{
my $sub= shift(@_);
isa($sub,"CODE") or _Croak(
"No code reference given" );
my $max= 0;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-base.t view on Meta::CPAN
DONE_TESTING:
done_testing;
# XXX temporary function
sub rand_between_ok(&$$) {
my ($block, $min, $max, $name) = @_;
my @res;
my %res;
for (1..10) {
my $res = $block->();
view all matches for this distribution
view release on metacpan or search on metacpan
our @EXPORT = qw( );
our $VERSION = '0.14';
sub Sort(&@) {
my $callback=shift;
_sort($callback, \@_);
return @_;
}
sub Sort_inplace(&\@) {
my $callback=shift;
return _sort($callback, $_[0]);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Ambrosia/Assert.pm view on Meta::CPAN
*{"${package_instance}::assert"} = sub(&$) {};
}
}
sub __assert(&$)
{
my $condition = shift;
if (( ref $condition eq 'CODE' && !$condition->() ) || !$condition)
{
carp( 'error: ' . shift);
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/AnyEvent/AggressiveIdle.pm view on Meta::CPAN
undef $WATCHER unless %IDLE;
}
}
}
sub aggressive_idle(&) {
our ($WOBJ, $WOBJR, %IDLE, $WATCHER, $NO);
($WOBJR, $WOBJ) = portable_pipe unless defined $WOBJ;
$NO = 0 unless defined $NO;
$WATCHER = AE::io $WOBJ, 1, \&_watcher unless %IDLE;
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/AnyEvent/Callback.pm view on Meta::CPAN
my $new_cb = $cb->CB(sub { ... }, sub { ... }); # the same
=cut
sub CB(&;&) {
my $parent;
my ($cb, $ecb) = @_;
($parent, $cb, $ecb) = @_ unless 'CODE' eq ref $cb;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Capture.pm view on Meta::CPAN
exports => [qw( capture )],
groups => { default => [qw( capture )] },
};
sub capture(&) {
my( $todo ) = @_;
my $cv = AE::cv;
my(@results) = $todo->( sub { $cv->send(@_) } );
return $cv->recv;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent.pm view on Meta::CPAN
$ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6";
}
our @post_detect;
sub post_detect(&) {
my ($cb) = @_;
push @post_detect, $cb;
defined wantarray
lib/AnyEvent.pm view on Meta::CPAN
&{ shift @POSTPONE }
while @POSTPONE;
}
sub postpone(&) {
push @POSTPONE, shift;
$POSTPONE_W ||= AE::timer (0, 0, \&_postpone_exec);
()
view all matches for this distribution