Glenn Linderman wrote:
>
> If a curried subroutine is truly generated because of seeing an
> expression containing placeholders, then that expression contains some
> finite number of placeholders. Each placeholder turns into a parameter
> of the generated subroutine. The generated subroutine has, I assume,
> an internal name or id or address by which it is called. However, it
> can only be called in exactly one place: the place in the source code
> from which the subroutine was generated. That place calls it with
> exactly the correct number of parameters.
>
> Hence, unless there are additional related RFCs not yet submitted
> which describe ways to define names of curried subroutines, and
> techniques for relating curryable expressions such that only one
> subroutine is generated for multiple curried expressions, I fail to
> see any way in which they can be called with fewer than the required
> number of arguments.
>
> What am I missing?
$add = ^a + ^b;
# a thousand lines later...
$incr = $add->(1);
# a thousand lines later...
$x = $incr->($x);
or:
winnow ^a <=> ^b, @list;
# a long time ago, in a module far, far away...
my $magic_val = 7;
sub winnow ( $compare, @data ) {
my $magic_compare = $compare->($magic_val);
return grep $magic_compare, @data;
}
Damian