Acme-Lambda-Expr
view release on metacpan or search on metacpan
lib/Acme/Lambda/Expr/Operators.pm view on Meta::CPAN
my $operand = $self->operand;
return sub{ abs &{$operand} };
}
__PACKAGE__->meta->make_immutable();
package Acme::Lambda::Expr::Log;
use Moose;
extends qw(Acme::Lambda::Expr::UniOp);
sub symbol{
return q{log};
}
sub codify{
my $self = shift;
my $operand = $self->operand;
return sub{ log &{$operand} };
}
__PACKAGE__->meta->make_immutable();
package Acme::Lambda::Expr::Sqrt;
use Moose;
extends qw(Acme::Lambda::Expr::UniOp);
sub symbol{
return q{sqrt};
}
lib/Acme/Lambda/Expr/Term.pm view on Meta::CPAN
cmp _str_compare
! _not
neg _negate
~ _complement
cos _cos
sin _sin
exp _exp
abs _abs
log _log
sqrt _sqrt
int _int
atan2 _atan2
);
sub compile{
my($self) = @_;
my($pkg, $file, $line) = caller;
my $context = qq{package $pkg\n#line $line $file\n;};
lib/Acme/Lambda/Expr/Term.pm view on Meta::CPAN
}
sub _sin{
return Acme::Lambda::Expr::Sin->generate(@_);
}
sub _exp{
return Acme::Lambda::Expr::Exp->generate(@_);
}
sub _abs{
return Acme::Lambda::Expr::Abs->generate(@_);
}
sub _log{
return Acme::Lambda::Expr::Log->generate(@_);
}
sub _sqrt{
return Acme::Lambda::Expr::Sqrt->generate(@_);
}
sub _int{
return Acme::Lambda::Expr::Int->generate(@_);
}
__PACKAGE__->meta->make_immutable;
tool/operators.pl view on Meta::CPAN
{
my @uniops = (
_not => '!',
_negate => 'neg',
_complement => '~',
_cos => 'cos',
_sin => 'sin',
_exp => 'exp',
_abs => 'abs',
_log => 'log',
_sqrt => 'sqrt',
_int => 'int',
);
while(my($name, $uniop) = splice @uniops, 0, 2){
my $class_name = 'Acme::Lambda::Expr::'
. join '', map{ ucfirst } split /_/, $name;
if($uniop eq 'neg'){
$uniop = '-';
( run in 0.249 second using v1.01-cache-2.11-cpan-27979f6cc8f )