|Do you know where your variables are?|
Re: Re: Perl6 and Extreme Programmingby Jenda (Abbot)
|on May 26, 2002 at 22:42 UTC||Need Help??|
I am afraid you have it wrong. "Currying" and "higher-order functions" are two unrelated features that only have one thing in common: they often appear in functional languages. A function is "higher-order" if it accepts a function as it's parameter or if it returns a function (it "created").
Higher order functions are long supported by Perl 5, even though we usualy do not use that name. (I guess so that we do not scare people away. Higher-order functions sounds too "functional".)
On the other hand a function is curried if it returns a "partialy applied" function if called with only the first few parameters. Of course then it is also higer-order actualy, but that's not the point.
(Next day) Actually ... the second function is not a good example. It's both curried and uncurried. If I wanted a plain curried version I'd define it as
and then would call it either as
As you can see the syntax is not too nice in Perl. Currying is a bit alien to Perl, it looks much more natural in modern functional languages.