Computations are operations returning values. They do not modify the memory.
(text [C0 = COMPUTATION] ... [CN = COMPUTATION])
Returns a text
node containing the text representation of C0
… CN
.
(var {String})
Returns the value of the variable {String}
, or a reference to it if
applicable. Structure members can be accessed by using .
in {String}
.
(sequence {String})
Returns a [SEQUENCE]
value corresponding to the sequence named {String}
.
Said sequence can be defined at a later point.
{Structure Var Name}.{Field Name}
(field {String} [STRUCTURE VAR])
Accesses the {String}
field of the structure [STRUCTURE VAR]
. Using .
to
access fields is recommended over the use of this operator.
(get_field {String} [STRUCTURE])
Returns the value of the {String}
field of the structure [STRUCTURE]
.
(let (({V0 = String} [C0 = COMPUTATION]) ... ({VN = String} [CN = COMPUTATION])) [R = COMPUTATION])
Defines a hierarchical level and local variables {V0}
… {VN}
with values
[C0]
… [CN]
, and returns the value of [R]
.
(cast [TYPE] [COMPUTATION*])
Transforms [COMPUTATION*]
into a value of type [TYPE]
. Note that the variable
shorthand cannot be used for [COMPUTATION*]
. The following type changes are
allowed:
[FLOAT]
to [FLOAT]
, [INT]
, and [STRING]
.[INT]
to [FLOAT]
, [INT]
, and [STRING]
.[BOOL]
to [BOOL]
and [STRING]
.[STRING]
to [BOOL]
(true
and false
), [FLOAT]
, [INT]
, and[STRING]
.(rand [I0 = INT] [IN = INT])
Returns a random number between I0
and IN
(inclusive).
(and [B0 = BOOL] ... [BN = BOOL])
Standard conjunction (minimum of 2 arguments).
(or [B0 = BOOL] ... [BN = BOOL])
Standard disjunction (minimum of 2 arguments).
(not [BOOL])
Standard negation.
(implies [B0 = BOOL] [B1 = BOOL])
Standard implication.
(one_in [B0 = BOOL] ... [BN = BOOL])
true if, and only if, exactly one of the operands is true.
All operands must be of the same type, which is also the type returned by the operation.
(+ [N0 = NUMBER] ... [NN = NUMBER])
Standard addition (minimum of 2 arguments).
(- [N0 = NUMBER] ... [NN = NUMBER])
Standard substraction (minimum of 2 arguments).
(* [N0 = NUMBER] ... [NN = NUMBER])
Standard multiplication (minimum of 2 arguments).
(/ [N0 = NUMBER] [N1 = NUMBER])
Standard division. Note that a division on integers is indeed a integer division.
(^ [N0 = NUMBER] [N1 = NUMBER])
Standard exponentiation.
(% [I0 = INT] [I1 = INT])
Standard modulo operation.
(min [N0 = NUMBER] ... [NN = NUMBER])
Lowest value among the operands.
(max [N0 = NUMBER] ... [NN = NUMBER])
Highest value among the operands.
(clamp [N0 = NUMBER] [N1 = NUMBER] [N2 = NUMBER])
Equivalent to (max N0 (min N1 N2))
.
(abs [NUMBER])
Positive value of [NUMBER]
.
(= [C0 = COMPUTATION] ... [CN = COMPUTATION])
True if, and only if, all operands are equal.
(< [C0 = COMPARABLE] [C1 = COMPARABLE])
True if, and only if, C0
is strictly lower than C1
.
(=< [C0 = COMPARABLE] [C1 = COMPARABLE])
True if, and only if, C0
is lower or equal to/than C1
.
(> [C0 = COMPARABLE] [C1 = COMPARABLE])
True if, and only if, C0
is strictly higher than C1
.
(>= [C0 = COMPARABLE] [C1 = COMPARABLE])
True if, and only if, C0
is higher or equal to/than C1
.