Lingo expressions
As I said before LingoF allows to define function values in several ways.
A second approach is to use Lingo Expressions.
A Lingo expression is a string expression written in Lingo that can contain any Lingo Code that will evaluate to something.
Basically there are two fun overloads to create Lingo Expressions:
Single line: fun(” {argument 1} , { argument 2} , … , { argument n} : { Lingo Expression }”)
Multiple lines : fun({arguments}, { Lingo sentence or List of Lingo sentences })
Where arguments can be a comma delimitted string or a list of strings and each Lingo sentence will be a string.
Note 1 : in the latter overload I said “Lingo sentence” and not “Lingo expression”. That means that the return sentence should be included otherwise it will not return any value.
Note 2: arguments in both cases are what is referred to as free variables in Lambda Calculus.
So going back to our first example, we could have defined the add function this way:
add = fun("x,y : x+y")