Operators
This page lists all the operators available in the language for use to process data. With except to the assignment and EQL operators, all of them operate on the scalar values (strings, numbers).
In order to allow for table/matrix operations, looping must be employed to iterate over all keys of the table and processing it’s values one by one.
Due to ASTER dynamic typing approach, numeric operations (like +, -= or ==) require both sides to evaluate as numbers, or will fail otherwise with lcx_impossible_math error. So writing “A” == 2 will result in such a failure, as “A” cannot be converted to nor operated as a number.
This is a language feature, as it allows to signal an error condition where numbers are expected but by an error a textual data is provided, which aids in detecting edge conditions during data processing tests. Use $== operator to compare strings.
In cases where a value comparison is needed, that ignores the type but should provide a numeric comparison, the ~= operator and it’s negated sibling !~= are introduced.
These operators try to compare both as string and as number, ignoring the type difference, focusing on the actual value. So if You expect Your data field to be either text, number, float or empty, but want a certain condition to be true if it’s equal numerically, use ~=.
Providing direct numerical values to bitwise operators threats them as 32-bit signed integers. So that (FROM_HEX(“FFFFFFFF”) BXOR 5) is equal to (FROM_HEX(“FFFFFFFF”) BXOR FROM_HEX(“00000005”), and similarly (FROM_HEX("FFFFFFFF") BXOR -5) $== (FROM_HEX("FFFFFFFF") BXOR FROM_HEX("FFFFFFFB"))
Operator | Role | Example |
|---|---|---|
| List collecting operator |
|
| Operation separator |
|
| Assignment done by value copy |
|
| Numeric addition in-place |
|
| Numeric subtraction in-place |
|
| Numeric multiplication in-place |
|
| Numeric division in-place |
|
| Numeric modulo (reminder) in-place |
|
| String concatenation in-place |
|
| Numeric addition |
|
| Numeric subtraction |
|
| Numeric multiplication |
|
| Numeric division |
|
| Numeric modulo (reminder) |
|
| Grouping, function parameters |
|
| Table / List indexing operator |
|
| Alternative indexing operator |
|
| Dynamic symbol name operator |
|
| Inline processing operator Allows to mixin expressions within strings avoiding the sometimes superfluous usage of string concatenation operator Use the string escape character |
|
| Logical AND |
|
| Logical OR |
|
| Logical negation |
|
| Short circuiting AND |
|
| Short circuiting OR |
|
| Logical AND negated |
|
| Logical OR negated |
|
| Logical Exclusive OR |
|
| Bitwise AND |
|
| Bitwise OR |
|
| Bitwise XOR Please note that bitwise negation is not defined as operation due to unceratinity on the argument width, so XOR’ing bitwise with all 1’s (e.g. FF) is the way to do bitwise negation - as shown in the example. |
|
| Deep comparison of two values - compares values, lists, lists of list and so on for functional equality. |
|
| Check if element is contained in list, using deep comparison. |
|
| Numeric equality |
|
| Numeric inequality |
|
| Numeric greater or equal |
|
| Numeric greater |
|
| Numeric less |
|
| Numeric less or equal |
|
| String concatenation |
|
| String equal |
|
| String inequality |
|
| String greater or equal |
|
| String greater |
|
| String less |
|
| String less or equal |
|
| General data equality |
|
| General data inequality |
|