|Syntactic Confectionery Delight|
Re: Near-free function currying in Perlby Limbic~Region (Chancellor)
|on Nov 17, 2004 at 14:30 UTC||Need Help??|
Ok - I have to admit that I don't fully understand currying or a lot of other concepts from functional programming (FP). I have a few questions - some in general and some specific to your implementation.
A common way in Perl to simulate currying is as follows:
I am guessing the same in a FP language might look like:
How does it know that I am finishing off one and not starting another? Or if the 3rd time I called greeting() I did it with two arguments - what then?
The next question is with your statement:
My final question for now is an apparent flaw in the design. Currying, as I understand it, only works if I don't have the last x arguments. What if I have the middle argument and the entire function requires 5? In Perl, that would be easy because I would use a hash ref and "name" my arguments. I don't see how currying helps in this situation (real currying, not Perl's substitute).Thanks by the way - I am impressed.
Cheers - L~R
Update: Added a clarification to distinguish between FP currying and the simulation of currying in Perl