Skip to content

Expressions

Expressions are made from variables, values, operators, and function calls.

U has many expression types:

Application

Most expressions use in U are applying functions with/without parameters. Applications are made by separating two values with whitespaces like f 1.

U supports also method chaining: 'f(1).f2(42)'.

Juxtaposition

For optimal expressiveness, U is whitespace sensitive. This design choice enables a new expression type: Juxtapositions. Juxtapositions are function calls between two values without whitespaces like f(a, b):

f(a,b)        # 'f' + '(a,b)' => function call
[1,2]{: ...}  # Array '[...]' + Function '{}' => array iteration

Evaluation failure

Sometimes an expression might fail to evaluate to a value for two reasons:

  • Evaluation raises an exception.
  • Evaluation never terminates: e.g., recursion, infinite loop.