Currying: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(Add Ecstasy example) |
||
Line 426: | Line 426: | ||
9 |
9 |
||
</pre> |
</pre> |
||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |
||
[[EchoLisp]] has native support for curry, which is implemented thru closures, as shown in [[CommonLisp]] . |
[[EchoLisp]] has native support for curry, which is implemented thru closures, as shown in [[CommonLisp]] . |
||
Line 449: | Line 450: | ||
→ (λ _#:g1004 (#apply-curry #* (2 3 4) _#:g1004)) |
→ (λ _#:g1004 (#apply-curry #* (2 3 4) _#:g1004)) |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|Ecstasy}}== |
|||
<syntaxhighlight lang="java">module CurryPower |
|||
{ |
|||
@Inject Console console; |
|||
void run() |
|||
{ |
|||
function Int(Int, Int) divide = (x,y) -> x / y; |
|||
function Int(Int) half = divide(_, 2); |
|||
function Int(Int) partsOf120 = divide(120, _); |
|||
console.println($|half of a dozen is {half(12)} |
|||
|half of 120 is {partsOf120(2)} |
|||
|a third is {partsOf120(3)} |
|||
|and a quarter is {partsOf120(4)} |
|||
); |
|||
} |
|||
}</syntaxhighlight> |
|||
=={{header|Eero}}== |
=={{header|Eero}}== |