Currying: Difference between revisions

no edit summary
No edit summary
Line 1,884:
 
Since a three-argument function can be defined directly, and has advantages like diagnosing incorrect calls which pass fewer than three or more than three arguments, currying is not useful in this language. Similar reasoning applies as given in the "Why not real currying/uncurrying?" paragraph under the Design Rationale of Scheme's SRFI 26.
 
=={{header|Vala}}==
<lang Vala>delegate double Dbl_Op(double d);
 
Dbl_Op curried_add(double a) {
return (b) => a + b;
}
 
void main() {
print(@"$(curried_add(3.0)(4.0))\n");
double sum2 = curried_add(2.0) (curried_add(3.0)(4.0)); //sum2 = 9
print(@"$sum2\n");
}</lang>
{{out}}
<pre>
7
9
</pre>
 
=={{header|Visual Basic .NET}}==
Anonymous user