Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Currying/Nemerle/currying.nemerle
Normal file
20
Task/Currying/Nemerle/currying.nemerle
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Console;
|
||||
|
||||
module Curry
|
||||
{
|
||||
Curry[T, U, R](f : T * U -> R) : T -> U -> R
|
||||
{
|
||||
fun (x) { fun (y) { f(x, y) } }
|
||||
}
|
||||
|
||||
Main() : void
|
||||
{
|
||||
def f(x, y) { x + y }
|
||||
def g = Curry(f);
|
||||
def h = Curry(f)(12); // partial application
|
||||
WriteLine($"$(Curry(f)(20)(22))");
|
||||
WriteLine($"$(g(21)(21))");
|
||||
WriteLine($"$(h(30))")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue