Skip to main content
Skip table of contents

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
also used as function argument separator

A=(3,2,1)
# equals to
# A[1] = 3; A[2] = 2; A[3] = 1

;

Operation separator
returns the value of last operation

# separates steps of execution
A=3;B=2;C=A*B # sets C, evals to 6

=

Assignment done by value copy
also copies complete lists and tables

A = 2 # sets A to 2, evals to 2

+=

Numeric addition in-place

A=2; A+=2 # evals to 4, A updated

-=

Numeric subtraction in-place

A=3; A-=1 # evals to 2, A updated

*=

Numeric multiplication in-place

A=2; A*=2 # evals to 4, A updated

/=

Numeric division in-place

A=9; A/=3 # evals to 3, A updated

%=

Numeric modulo (reminder) in-place

A=5; A%=3 # evals to 2, A updated

&=

String concatenation in-place

A="A"; A&="B" # evals to “AB”
# A updated

+

Numeric addition

2+2 # evals to 4

-

Numeric subtraction

3-1 # evals to 2

*

Numeric multiplication

2*2 # evals to 4

/

Numeric division

9/3 # evals to 3

%

Numeric modulo (reminder)

5%3 # evals to 2

()

Grouping, function parameters

e.g. Function(param1, param2)

[]

Table / List indexing operator

A[2][1] # returns element
A[2]["FIELD"] = "value" # assignment

\

Alternative indexing operator
only for reading, not for assigning

A\2\1 # returns element
value = A\2\1 # reading only!
value = A\1\"OFF" # reading only!

{}

Dynamic symbol name operator

{"A"}[2][1] # evals to A[2][1]

{} (in texts)

Inline processing operator

Allows to mixin expressions within strings avoiding the sometimes superfluous usage of string concatenation operator &

Use the string escape character \ to avoid processing

A=1234;
"0" & A & "56"; # evals to 0123456
"0{A}56"; # evals to 0123456

"AB\{CD\{EF\}" # evals to AB{CD{EF}

AND

Logical AND

(2>3) AND (2<3) # evals to false

OR

Logical OR

'X' OR (3<1) # evals to true

NOT

Logical negation

NOT 'X' # evals to false

|AND

Short circuiting AND
evals only left argument if that is sufficient

(2>3) |AND ((A=2)>1) # evals false
# Assignment to A will not be done!

|OR

Short circuiting OR
evals only left argument if that is sufficient

(3>2) |OR ((A=2)>1) # evals true
# Assignment to A will not be done!

NAND

Logical AND negated

(2>3) NAND (2<3) # evals to true

NOR

Logical OR negated

'X' NOR (3<1) # evals to false

XOR

Logical Exclusive OR

'X' XOR (3<1) # evals to true

BAND

Bitwise AND

TO_HEX(FROM_HEX("00000031") BAND 16)

# results in 00000010

BOR

Bitwise OR

TO_HEX(LTB((0,127)) BOR LTB((128,128)))
# results in 80FF

BXOR

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.

BTL(LTB((255)) BXOR LTB((128)))
# results in 127

# negation example - 16 bit word
(FROM_HEX("ABC") BXOR LTB((255,255))) $== FROM_HEX("F543")

EQL

Deep comparison of two values - compares values, lists, lists of list and so on for functional equality.
If two items are deeply equal it means that passing them to the same program will return the same result.

A[1]=123;
A[2]=123;
B[1]=123;
B[2]=123;
A EQL B; # evals to true

IN

Check if element is contained in list, using deep comparison.

A[1]=3;
A[2]=5;
A[3]=7;
2 IN A; # evals to false
3 IN A; # evals to true

==

Numeric equality

3 == 3 # evals to true

!=

Numeric inequality

3 != 3 # evals to false

>=

Numeric greater or equal

3 >= 3 # evals to true

>

Numeric greater

3 > 1 # evals to true

<

Numeric less

2 < 5 # evals to true

<=

Numeric less or equal

3 <= 3 # evals to true

&

String concatenation

“A” & “B” # evals to “AB”

$==

String equal

“A” $== “A” # evals to true

$!=

String inequality

“A” $!= “A” # evals to false

$>=

String greater or equal

“A” $>= “A” # evals to true

$>

String greater

“A” $> “B” # evals to true

$<

String less

“B” $< “A” # evals to true

$<=

String less or equal

“A” $<= “A” # evals to true

~=

General data equality

“ 2.00” ~= (3-1) # evals to true

!~=

General data inequality

“A” !~= 2 # evals to true

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.