Expression
Basic blocks of Swan to combine flows.
An expression (expr) is built from valid identifiers representing flows, constant, sensor and combine pre-defined operators and more complex operators. The following sections list the operators, each of them having its own reference card explaining how to use it in an expression.
Basic
| Identifier expression | ident_expr |
| Atom | true, false, INTEGER, TYPED_INTEGER, FLOAT, TYPED_FLOAT, CHAR |
Combinational Operations
| Binary Arithmetic | +, -,*, /,mod |
| Unary arithmetic | - |
| Numeric cast | :> |
| Boolean | and, or, xor,not |
| Relational | <>,=, <, <=,>, >= |
| Bitwise | land, lor, lxor, lnot, lsl, lsr |
| Selection | if/then/else, case |
Sequential Operations
| Binary Operators | ->, pre, window |
| Unary Operators | pre |
Operations on arrays
| Constructor | Array Constructor ([_]),Repetition (^), Append (@) |
| Flatten | flatten |
| Access | Projection (_[i]),Projection with (_.[_] default _), Slice (_[i..j]) |
| Modification | reverse,transpose, Array Functional Update (_ with [_] = _) |
Operations on structures
| Constructor | Structure Constructor ({_}) |
| Destructor | Structure Destructor (.(_)) |
| Access | Projection (.l) |
| Modification | Structure Functional Update (_with .l) |