Functions
a simple (commented example)
#! declare function 'test_function'
#! with return type int
#! taking an int as argument
fun int test_function(int arg) {
#! return the argument + 2
return arg + 2;
}
#! now call the function (and debug print the result)
<<< test_function(0) >>>;
#! or use alternate syntax
<<< 1 => test_function >>>;
Partial Application
According to wikipeda: In computer science, partial application (or partial function application) refers to the process of fixing a number of arguments to a function, producing another function of smaller arity.
In gwion, you can use a hole _
to achieve that
fun int test(int i, int j) {
return i + j;
}
test(_, 2) :=> const auto mytest;
<<< 40 => mytest >>>;