Lambdas
Lambda (anonymous) functions may appear in expressions as:
\(a:A, b:B) -> C {
c:C;
// do something
return c;
}
\(A, B) -> C
. It is possible to declare a variable of this function type:
f:\(A, B) -> C;
f <- \(a:A, b:B) -> C {
c:C;
// do something
return c;
};
f(a, b);
Functions can accept lambdas as arguments. Such a function may be declared:
function g(f:\(A, B) -> C) -> D {
d:D;
// do something
return d;
}
g(\(a:A, b:B) -> C {
c:C;
// do something
return c;
});
f:\(A, B) -> C
as above:
g(f);