
Sub::Curried - Currying of subroutines via a new 'curry' declarator

curry add_n_to ($n, $val) {
return $n+$val;
}
my $add_10_to = add_n_to( 10 );
say $add_n_to->(4); # 14
# but you can also
say add_n_to(10,4); # also 14
# or more traditionally
say add_n_to(10)->(4);

Currying and Partial Application come from the heady world of functional programming, but are actually useful techniques. Partial Application is used to progressively specialise a subroutine, by pre-binding some of the arguments.
Partial application is the generic term, that also encompasses the concept of plugging in "holes" in arguments at arbitrary positions. Currying is (I think) more specifically the application of arguments progressively from left to right until you have enough of them.

Devel::Debug provides the magic (yes, there's a teeny bit of code generation involved, but it's not a global filter, rather a localised parsing hack).
There are several modules on CPAN that already do currying or partial evaluation:

(c)2008 osfameron@cpan.org
This module is distributed under the same terms and conditions as Perl itself.
Please submit bugs to RT or shout at me on IRC (osfameron on #london.pm on irc.perl.org)