Documentation
Operator table
Most of the ContRap operators are prefixed with the ''operator''-keyword. The parser will continue reading the next token after the ''operator''-keyword thus considering it as a part of the operator name.
Parser syntax | Operator | Typical usage |
---|---|---|
a and b | and(a,b) | Logical ''and''-operation |
a or b | or(a,b) | Logical ''or''-operation |
not a | not(a) | Logical ''not''-operation |
a + b | operator+(a,b) | Infix addition |
-a | operator-(a) | Prefix subtraction |
a - b | operator+(a,operator-(b)) | Infix subtraction |
a * b | operator*(a,b) | Infix multiplication |
a / b | operator/(a,b) | Infix division |
a ^ b | operator^(a,b) | Power, transposition, conjugation |
a! | operator!(a) | Factorial |
a | b | operator|(a,b) | Scalar product, inner product |
a[b,...] | operator[](a,b,...) | Element access for complex structures |
a := b | operator:=(a) | Assignment operator |
a = b | operator=(a,b) | Equations, semantic equality |
a == b | operator==(a,b) | Syntactic identity, identity |
a < b | operator<(a,b) | Order relations |
a <= b | operator<=(a,b) | Order relations |
a > b | operator>(a,b) | Order relations |
a >= b | operator>=(a,b) | Order relations |
a <- b | operator<-(a,b) | Appending, concatenation from right |
a << b | operator<<(a,b) | Element appending from right, left shift |
a -> b | operator->(a,b) | Appending, concatenation from left |
a >> b | operator>>(a,b) | Element appending from left, right shift |
You can define your own operators using the register_operator-method of the ContRap Parser class.