-
Notifications
You must be signed in to change notification settings - Fork 89
Define function
NN--- edited this page Apr 11, 2012
·
3 revisions
-
Category: Defining Operator
-
Description: define a function and composite functions and pipeline
-
Code:
using System.Console;
def localFunction() {
def f1(a) { a + 1 }
def f2 = _ * 10; // partial application of operator "*"
def ff = f1 >> f2;
def r = ff(3);
def r1 = 3 |> f1 |> f2;
WriteLine($"result = $r and result1 = $r1");
WriteLine($"is equal $(r == r1)")
}
localFunction()
- Execution Result:
result = 40 and result1 = 40 is equal True
[Copyright ©](Terms of use, legal notice)