Currying: Difference between revisions

Content added Content deleted
(Add Ecstasy example)
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag)
Line 452: Line 452:


=={{header|Ecstasy}}==
=={{header|Ecstasy}}==
<syntaxhighlight lang="java">module CurryPower
<syntaxhighlight lang="java">
module CurryPower
{
{
@Inject Console console;
@Inject Console console;
Line 462: Line 463:
function Int(Int) partsOf120 = divide(120, _);
function Int(Int) partsOf120 = divide(120, _);


console.println($|half of a dozen is {half(12)}
console.print($|half of a dozen is {half(12)}
|half of 120 is {partsOf120(2)}
|half of 120 is {partsOf120(2)}
|a third is {partsOf120(3)}
|a third is {partsOf120(3)}
|and a quarter is {partsOf120(4)}
|and a quarter is {partsOf120(4)}
);
);
}
}
}</syntaxhighlight>
}
</syntaxhighlight>

{{out}}
<pre>
half of a dozen is 6
half of 120 is 60
a third is 40
and a quarter is 30
</pre>


=={{header|Eero}}==
=={{header|Eero}}==