Acme-Lambda-Expr

 view release on metacpan or  search on metacpan

lib/Acme/Lambda/Expr.pm  view on Meta::CPAN

	}
	if(Data::Util::is_code_ref($subr)){
		return Acme::Lambda::Expr::Function->new(
			function => $subr,
			args     => \@args,
		);
	}
	else{
		my $invocant = shift @args;
		return Acme::Lambda::Expr::Method->new(
			method   => $subr,
			invocant => $invocant,
			args     => \@args,
		);
	}
}

our $x = placeholder(0);
our $y = placeholder(1);

Internals::SvREADONLY($x, 1);
Internals::SvREADONLY($y, 1);

1;
__END__

=head1 NAME

Acme::Lambda::Expr - Lambda expressions

=head1 VERSION

This document describes Acme::Lambda::Expr version 0.01

=head1 SYNOPSIS

	use strict;
	use feature 'say';
	use Acme::Lambda::Expr qw(:all);

	my $f = $x * 2 + $y;
	say $f->(20, 2); # 20*2 + 2 = 42

	my $g = curry $f, $x, 4;
	say $g->(19);    # 18*2 + 4 = 42

	my $h = curry deparse => $x;
	say $h->($f); # $f->deparse()
	say $h->($g); # $g->deparse()

	say $g->compile->(19); # => 42

=head1 DESCRIPTION

This module provides lambda expressions.

=head1 DEPENDENCIES

Perl 5.8.1 or later.

=head1 BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to
C<bug-acme-lambda-expr@rt.cpan.org/>, or through the web interface at
L<http://rt.cpan.org/>.

=head1 SEE ALSO

L<http://www.boost.org/>.

=head1 AUTHOR

Goro Fuji E<lt>gfuji(at)cpan.orgE<gt>

=head1 LICENSE AND COPYRIGHT

Copyright (c) 2008, Goro Fuji E<lt>gfuji(at)cpan.orgE<gt>. Some rights reserved.

This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

=cut

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.420 second using v1.00-cache-2.02-grep-82fe00e-cpan-dad7e4baca0 )