Skip to content

Standard library

zumisha edited this page Jun 1, 2021 · 4 revisions

Work with a tuple.

Tuples are indexed from one.

[i] - Get the i-th element of the tuple.

[-i] - Get the i-th element from the end of the tuple.

id - Returns the input tuple.

([1] * ... * [n]).tupleLen - Returns integer n - the length of the tuple.


Boolean functions.

undefined is represented as false.

empty tuple is represented as true.

([1]).not

([1] * [2]).and

Both [1] and [2] are calculated (possibly in parallel).

If you need a sequential calculation, use the construct ([1] -> [2]) ->

([1] * [2]).or

Both [1] and [2] are calculated (possibly in parallel).

If you need a sequential calculation, use the construct ([1] .not -> [2], true) ->

([1] * [2]).xor

([1] * [2]).equal

([1] * [2]).nequal

([1] * [2]).greater

([1] * [2]).less

([1] * [2]).gequal

([1] * [2]).lequal


Arithmetic functions.

([1] * [2]).add

([1] * [2]).sub

([1] * [2]).mul

([1] * [2]).div

([1] * [2]).mod

([1]).abs

([1]).sqrt

([1]).exp

([1]).ln

([1]).round - Mathematical rounding.

([1]).sin

([1]).cos

([1]).tan

([1]).asin

([1]).atan

Pi - Returns the Pi number.

E - Returns the base of the natural logarithm.

rand - Returns a random real number between 0 and 1.


Type conversions.

([1]).toInt

([1]).toReal

([1]).toString


Input-Output.

print - Prints an element or a tuple of elements to the console.

printType - Prints the element type or tuple of the element types to the console.

([1] * [2]).openFile - Reads a file on the path [1] to a value of type as value [2]. In case of failure, returns undefined.

([1] * [2]).createFile - Create or clear a file along the path [2] and write the value [1] to it. Removes the read-only attribute. If successful, returns true, otherwise false.

([1] * [2]).appendFile - Write the value [1] to the end of the file along the path [2]. Removes the read-only attribute. If successful, returns true, otherwise false.

Clone this wiki locally