1Moose::Autobox::Code(3)User Contributed Perl DocumentatioMnoose::Autobox::Code(3)
2
3
4

NAME

6       Moose::Autobox::Code - the Code role
7

VERSION

9       version 0.16
10

SYNOPSIS

12         use Moose::Autobox;
13
14         my $adder = sub { $_[0] + $_[1] };
15         my $add_2 = $adder->curry(2);
16
17         $add_2->(2); # returns 4
18
19         # create a recursive subroutine
20         # using the Y combinator
21         *factorial = sub {
22             my $f = shift;
23             sub {
24                 my $n = shift;
25                 return 1 if $n < 2;
26                 return $n * $f->($n - 1);
27             }
28         }->y;
29
30         factorial(10) # returns 3628800
31

DESCRIPTION

33       This is a role to describe operations on the Code type.
34

METHODS

36       "curry (@values)"
37       "rcurry (@values)"
38       "conjoin (\&sub)"
39       "disjoin (\&sub)"
40       "compose (@subs)"
41           This will take a list of @subs and compose them all into a single
42           subroutine where the output of one sub will be the input of
43           another.
44
45       "y" This implements the Y combinator.
46
47       "u" This implements the U combinator.
48
49       "meta"
50

SEE ALSO

52       <http://en.wikipedia.org/wiki/Fixed_point_combinator>
53       <http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/20469>
54

SUPPORT

56       Bugs may be submitted through the RT bug tracker
57       <https://rt.cpan.org/Public/Dist/Display.html?Name=Moose-Autobox> (or
58       bug-Moose-Autobox@rt.cpan.org <mailto:bug-Moose-Autobox@rt.cpan.org>).
59
60       There is also a mailing list available for users of this distribution,
61       at <http://lists.perl.org/list/moose.html>.
62
63       There is also an irc channel available for users of this distribution,
64       at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
65

AUTHOR

67       Stevan Little <stevan.little@iinteractive.com>
68
70       This software is copyright (c) 2006 by Infinity Interactive, Inc.
71
72       This is free software; you can redistribute it and/or modify it under
73       the same terms as the Perl 5 programming language system itself.
74
75
76
77perl v5.28.0                      2016-05-03           Moose::Autobox::Code(3)
Impressum