===== Operator list ===== * ** a . b ** Object property access operator. * ** .() ** Indirection operator. * ** new a ** New operator createas a new object instance from the template specified by name atom.Database objects created with new are considered dynamic database objects: assigned replica id is __never__ 0.REFERENCES is returned when template_name is of type ATOMS. * ** a = b ** Assignment. * ** a := b ** Assign into / overwrite. Equivalent to [ a ] = b * ** () ** Defines execution precedence.Function call delimiter.Switch expression delimiter. * ** | | ** Const vector delimiter. * ** { } ** Const list delimiter. Explicit type cast delimiter. * ** a , b** Const vector separator. Const list separator. Explicit type cast separator. Function parameter separator. Switch expression separator. * ** a ; b** Comma operator (a is executed first, the result is b) . ---- * ** - a ** Negative a.List operator. * ** a += b ** Equivalent to: a = a + b List operator. * ** a -= b ** Equivalent to: a = a - b List operator. * ** a *= b ** Equivalent to: a = a * b List operator. * ** a /= b ** Equivalent to: a = a /= b List operator. * ** a %= b ** Equivalent to: a = a % b List operator. * ** a - b ** Subtraction. Result is always of the same type as operand a. List operator. * ** a + b ** Addition. Result is always of the same type as operand a. List operator. * ** a * b ** Multiplication. Result is always of the same type as operand a. List operator. * ** a / b ** Division. Result is always of the same type as operand a. List operator. * ** a % b ** Modulo. Result is always of the same type as operand a. List operator. * ** len b ** Length of a vector or float list. List operator for vector lists. * ** lensqr b ** Square length of a vector or float list. List operator for vector lists. * ** abs a ** Absolute value of a .List operator. * ** sgn a** List operator. * ** degclp a ** Converts angle a to -180 .. 180 degrees range. List operator. * ** sqr a ** List operator. * ** a log b** * ** a pow b ** ---- * ** a ** b ** Vector dot multiplication (3d). List operator. * ** a dot b ** Vector dot multiplication (4d or more for FLOATS) List operator for vector lists. * ** a cross b ** Vector cross multiplication. List operator. ---- * ** not a ** Logical not. Result is always INTEGER 0 or 1. * ** a and b ** Logical and. Result is always INTEGER 0 or 1. * ** a nand b ** Logical nand. Result is always INTEGER 0 or 1. * ** a or b ** Logical or. Result is always INTEGER 0 or 1. * ** a xor b ** Logical xor. Result is always INTEGER 0 or 1. * ** bool a ** Logical evaluation. Result is INTEGER or INTEGERS. -1 = true, 0 = false (suitable for binary operations) * ** a andf b ** Evaluate a, if TRUE evaluate and return b, if FALSE return a. * ** a orf b ** Evaluate a, if TRUE return a, if FALSE evaluate and return b. ---- * ** a min b ** When a is single token type: if FLOAT { a } <= FLOAT { b } : return reference to a, else: return reference to b. When a is list: return a new list c, where c[i] = a[i] min b[i]. * ** a max b ** When a is single token type: if FLOAT { a } >= FLOAT { b } : return reference to a, else: return reference to b. When a is list: return a new list c, where c[i] = a[i] max b[i]. ---- * ** ^ a ** Remove duplicates from list. Preserves order of items. * ** a ^* b ** Cross-section between lists a and b. Duplicate items as in list a will not be removed. Preserves order of items as in list a. * ** a ^- b ** Remove list b from list a. Duplicate items as in list a will not be removed. Preserves order of items as in list a. * ** a ^+ b ** Union of lists. All duplicate items will be removed. * ** minin list ** Return index of first min element in list. * ** maxin list ** Return index of first max element in list. * ** count a ** Number of elements in list. When a is REFERENCE, number of properties on database object. * ** flip a ** Flip/revert list. * ** a in b ** Find first item in list - return index or 0. List operator. * ** a nin b ** Find first non-matching item in list - return index or 0 If a is a list, index to the first item in b that does not match any item in a, is returned. * ** a scan b ** Faster equivalent to ((b in a) <> 0). * ** a nscan b ** Faster equivalent to ((b in a) == 0). * ** a ++ b or: a append b ** Append two items/lists into a new list. * ** list[ index ]** List operator. Nul is returned when index is out of range. If index is a single token type (integer), a reference to list item is returned (ie: a[x] = ...) If index is a list (of integers), a new (remapped) list is returned. Works for vectors (only when index is single token type) 1-based indexes (a[1] == a|x, a[2] == a|y ...). * ** [ list[ index ] ]** Equivalent (but faster) to ARRAY{list}[index] * ** last list ** Equivalent (but faster) to list[count list]. ---- * ** a .. b ** Range: generate a list of integers { a, a +[-]1, a +[-]2, a +[-]3 ... b } Generated list contains at least one element (when a == b). * ** seq(a, cnt [, stp])\\ seqi(a, cnt [, stp])\\ seqf(a, cnt [, stp])\\ seqv(a, cnt [, stp]) ** Sequence: generate a list of integers, floats, vectors: { a + n * stp } n = 0 .. cnt Generated list is empty when cnt <= 0. ---- * ** a == b ** Comparison operator, a equals b. * ** a <> b ** Comparison operator, a not equal b. * ** a < b ** Comparison operator, a less than b. * ** a > b ** Comparison operator, a greater than b. * ** a >= b ** Comparison operator, a greater or equal b. * ** a <= b ** Comparison operator, a less or equal b. ---- * ** a |type ** Type of property/local variable (result is an atom, eg. ‘ATOMS’, ‘ARRAY’, ‘FLOAT’...) When the property is undefined, the result is nul (atom ''). * ** a |class ** Type of database/engine object * ** a |name ** Template name of database/engine object * ** a |zone ** The name of the zone that object instance belongs to * ** a |fullname ** Template name of database/engine object, complete with zone name (zone:name) * ** a |replica ** Id of database object. 0 denotes a static database object. * ** a |props ** A list of object property names (list of atoms) * ** a |array ** An ARRAY of pointers to all object properties. * ** a |owner ** Returns REFERENCE to owner of engine object * ** a |x/y/z/w** Vector component access. List operator (returns FLOATS when a is VECTORS). When a is single token type, return reference to vector component (ie: a|x = ...) * ** a |r/g/b/a ** Vector component access. List operator (returns FLOATS when a is VECTORS). When a is single token type, return reference to vector component (ie: a|r = ...) a|r == a|x a|g == a|y a|b == a|z a|a == a|w ---- The following operators only accept integer/float/vector/list of integers/floats/vectors. When integer/list of integers is given, a float/list of floats is returned: * ** sin a** * ** cos a** * ** tan a** * ** deg a** * ** rad a** * ** exp a** * ** asin a** * ** acos a** * ** atan a** * ** sqrt a** ---- ===== Mathematical functions ===== * ** TYPE[] clip(TYPE[] x, TYPE minx, TYPE maxx) ** clip x to min & max ---- * ** TYPE[] rand(TYPE[] a, TYPE[] b)** random between a .. b * ** TYPES rand(TYPE a, TYPE b, INTEGER count) ** random between a .. b * ** TYPE rand(TYPE a) ** random between 0 .. a * ** TYPE & rand(TYPES list) ** random member of list a reference to item is returned (like []) * ** rand(list, list) ** a new list is generated with random selected values ---- * ** sum(vector/list/float/integer) ** sum of list or vector * ** mul(vector/list/float/integer) ** mul of list or vector * ** respace(VECTORS/FLOATS/INTEGERS) ** { a , b , c , d } -> { a , a + b , a + b + c , a + b + c + d , ... } ---- * ** FLOAT? polar(FLOATs x, FLOAT? y) ** angle * ** FLOAT? polar(VECTOR? vec) ** angle ---- * ** INTEGER? and(INTEGER? x, INTEGER? y) ** binary and * ** INTEGER(S) nand(INTEGER(S) x, INTEGER(S) y) ** binary nand * ** INTEGER(S) or(INTEGER(S) x, INTEGER(S) y) ** binary or * ** INTEGER(S) xor(INTEGER(S) x, INTEGER(S) y)** binary xor * ** INTEGER(S) shr(INTEGER(S) x, INTEGER(S) y) ** binary (arithmetic) shr * ** INTEGER(S) shl(INTEGER(S) x, INTEGER(S) y) ** binary (arithmetic) shl * ** INTEGER(S) and(INTEGER(S) x, INTEGER(S) y)** binary and * ** INTEGER(S) nob(INTEGER(S) x) ** binary not ---- * ** TYPES sort(TYPES) ** return a new list with sorted items * ** INTEGERS isort(TYPES) ** return an index list to sorted itemsa[isort(a)] is equivalent to sort(a)