Glenn Linderman wrote:
> 
> Nathan, thanks for zeroing in on this paragraph from RFC 23.  It raises a
> question in my mind about the meaning of the RFC, and whether the paragraph is
> even necessary, which could answer your question about implementation.
> 
> 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?
> 
> Nathan Torkington wrote:
just to make sure that i have this right:

currying is effectively a mechanism for partial evaluation of functions. ie add
x y

add3 = add 3

we could then use:

         add3 4 == 7

could you not implement currying by simply having some mechanism of storing the
stack? so what happens in the assignment to add3 is that you have a name and a
function associated with this curried function, when it is fully evaluated you
pass all the variables, ie 3 and 4 in this case to add and then it is evaluated.

waiting for the 'your crazy' replies,

peter 

 
> > Perl6 RFC Librarian writes:
> > > =head2 Re-currying deferred expressions
> > >
> > > The subroutines generated by a placeholder are not exactly like the
> > > equivalent subroutines shown above. If they are called with fewer than the
> > > required number of arguments, they return another higher order function,
> > > which now has the specified arguments bound as well.
> >
> > The implementation of this might be far from trivial.  The
> > IMPLEMENTATION section of this RFC should address this.  How would
> > Perl's innards have to change to make this possible?  Dan is, sadly,
> > on holiday.  Perhaps another internals hacker could step up and
> > address this.
> 
> --
> Glenn
> =====
> There  are two kinds of people, those
> who finish  what they start,  and  so
> on...                 -- Robert Byrne
> 
> _______________________________________________
> Why pay for something you could get for free?
> NetZero provides FREE Internet Access and Email
> http://www.netzero.net/download/index.html

-- 
"Speak loudly, and carry a beagle!" -- Charles Schulz

Reply via email to