Define function - vilinski/nemerle GitHub Wiki

Define function

  • 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)