Data Structures 1. Multi-value Functions 2. Lists and Streams 3. Descriptors 4. Trees

16   BUILT-IN DEFINITIONS

16.1 Increase array

16.2 Truncate array

16.3  Character to text conversion

16.4 Integer to text conversion

16.5 Integer to limited text conversion

16.6 Real to text conversion

16.7 Real to limited text conversion

16.8 Real to formatted text conversion

16.9 Text to integer conversion

16.10 Text to real conversion

16.11 Text to integer test

16.12 Text to real test

16.13 Log operations

A number of definitions are built-in the language.

16.1 Increase array

Signature:  increase(array(entity1), n = integer) -> array(entity1);

The increase function increases the specified array with n empty elements. It returns the increased array.

Example:     increase("ABCD", 3)?     ==>  "ABCD   "

16.2 Truncate array

Signature:  truncate(array(entity1), n = integer) -> nothing;

The truncate function truncates the specified array to n remaining elements. It returns nothing.

Example:

CharArray = "ABCDEFGH";
truncate(CharArray, 3);
CharArray?                 ==>  "ABC"

16.3  Character to text conversion

Signature:  text(character) -> text;

The text function converts the character to  text. It returns the text.

Example:    text('a')?                ==>  "a"

16.4 Integer to text conversion

Signature:  text(integer) -> text;

The text function converts the integer  to  text. It returns the text.

Examples:    text(12345)?              ==>  "12345"

text(-12345)?             ==>  "-12345"

16.5 Integer to limited text conversion

Signature:  text(integer, width = integer) -> text;

The text function converts  integer to text. The size of the text is specifed by the width.

Examples:    text(12345,8)?           ==>  "   12345"

text(-12345,8)?          ==>  "   -12345"

16.6 Real to text conversion

Signature:  text(real) -> text;

The text function converts the real  to  text. It returns the text.

Examples:    text(12345.678)?       ==>  "12345.678"

text(-12345.678)?      ==>  "-12345.678"

16.7 Real to limited text conversion

Signature:  text(real, width = integer) -> text;

The text function converts the real to text in the scientific notation. The size of the text is specifed by the width.

Examples:    text(123.45,12)?        ==>  " 1.2345e+002"

text(-123.45,12)?       ==>  "-1.2345e+002"

16.8 Real to formatted text conversion

Signature:  text(real, width = integer, fraction = integer) -> text;

The text function converts the real to text. The size of the text is specifed by the width. The size of the fraction is specified by integer value of fraction.

Examples:    text(12345.6789,9,2)?     ==>  " 12345.68"

text(-12345.6789,9,2)?    ==>  "-12345.68"

16.9 Text to integer conversion

Signature:  integer(text) -> integer;

The integer function converts text to an integer value.

Examples:    integer("12345")?         ==>  12345

integer("-12345")?        ==>  -12345

16.10 Text to real conversion

Signature:  real(text) -> real;

The real function converts text to a real value.

Examples:    real("12345.678")?       ==>  12345.678

real("-12345.678")?      ==>  -12345.678

16.11 Text to integer test

Signature:  isinteger(text) -> boolean;

The isinteger function examines the text to determine if it is an integer value. If so, the value of the returned boolean value is true, otherwise it is false.

Examples:

isinteger("12345")?        ==>  true

isinteger("123.45")?       ==>  false

16.12 Text to real test

Signature:  isreal(text) -> boolean;

The isreal function examines the text to determine if it is a real value. If so, the value of the returned boolean value is true, otherwise it is false.

Examples:

isreal("123.45")?        ==>  true

isreal("123,45")?        ==>  false

16.13 Log operations

Log operations are used to write entities to the log file. The built-in log operations are:

log(text)      -> nothing;

logln(text)    -> nothing;

log(entity1)   -> nothing;

logln(entity1) -> nothing;

 Part 1: Language Description Chapter 16: Built-in Definitions