Syntax for fun (function) statements

fun name [parameter1: domain1, paramter2: domain2, ..., parameterN: domainN]: domain {
    [body must evaluate to a value in Domain]
}

For example:

fun between [lower:Int, upper:Int]: Int {
    {answer: Int | lower<answer && answer<upper }
}

Notice that in this case we have written a set comprehension as the body of the function. If there is more than one solution to the comprehension, then the function will return the set of all solutions.

You can put constraints in the parameter list as reminders to yourself, although they are not actually enforced. For example:

fun name [param: some Int]: lone Int {
    ...
}

A function evaluates to a value. A similar construct is a predicate which returns either true or false, but is otherwise written the same.

Remind me what a function is.