When you work with containers (list
,
map
, record
), you may use the
following functions:
elemenettype[] append(
<element type>[] arg, <element type>
list_element)
;
The append(<element type>[], <element type>)
function
accepts two arguments: the first is a list of any element data type and the second is of the element data type.
The function takes the second
argument and adds it to the end of the first argument.
The function returns the new value of list specified as the first argument.
This function is alias of the push(<element type>[], <element type>)
function.
From the list point of view, append()
is much more natural.
void clear(
<element type>[] arg)
;
The clear(<element type>[])
function accepts one
list argument of any element data type. The function takes this argument and empties the
list. It returns void.
void clear(
map[<type of key>,<type of value>] arg)
;
The clear(map[<type of key>,<type of value>])
function accepts one
map argument. The function takes this argument and empties the
map. It returns void.
<element type>[] copy(
<element type>[] arg, <element type>[] arg)
;
The copy(<element type>[], <element type>[])
function accepts two
arguments, each of them is a list. Elements of both lists must be of
the same data type. The function takes the second argument, adds
it to the end of the first list and returns the new value of the
list specified as the first argument.
void copyByName(
record to, record from)
;
Copies data from the input record to the output record based on field names. Enables mapping of equally named fields only.
void copyByPosition(
record to, record from)
;
Copies data from the input record to the output record based on fields order. The number of fields in output metadata decides which input fields (beginning the first one) are mapped.
map[<type of key>, <type of value>] copy(
map[<type of key>, <type of value>] arg, map[<type of key>, <type of value>] arg)
;
The copy(map[<type of key>, <type of value>], map[<type of key>, <type of value>])
function accepts two
arguments, each of them is a map. Elements of both maps must be of
the same data type. The function takes the second argument, adds
it to the end of the first map replacing existing key mappings and returns the new value of the map specified as the first argument.
<element type>[] insert(
<element type>[] arg, integer
position, <element type>
newelement)
;
The insert(<element type>[], integer, <element type>
)
function accepts the following arguments:
the first is a list of any element data type, the second is integer, and
the other is of the element data type.
The function takes the
third argument
and inserts it
to the list
at the position defined by the second argument. The list specified as the first argument changes
to this new value and it is returned by the function.
Remember that the list element are indexed starting from 0.
boolean isEmpty(
<element type>[] arg)
;
The isEmpty(<element type>[])
function accepts one
argument of list of any element data type. It takes this argument, checks whether the list is empty and
returns true
, or false
.
boolean isEmpty(
map[<type of key>,<type of value>] arg)
;
The isEmpty(map[<type of key>,<type of value>])
function accepts one
argument of a map of any value data types. It takes this argument, checks whether the map is empty and
returns true
, or false
.
integer length(
structuredtype arg)
;
The length(structuredtype)
function
accepts a structured data type as its argument:
string
,
<element type>[]
, map[<type of key>,<type of value>]
or
record
. It takes the argument and returns a
number of elements forming the structured data type.
<element type> poll(
<element type>[] arg)
;
The poll(<element type>[])
function accepts one
argument of list of any element data type. It takes this argument, removes the
first element from the list and returns this element.
The list specified as the argument changes to this new value
(without the removed first element).
<element type> pop(
<element type>[] arg)
;
The pop(<element type>[])
function accepts one
argument of list of any element data type. It takes this argument, removes the
last element from the list and returns this element.
The list specified as the argument changes to this new value
(without the removed last element).
<element type>[] push(
<element type>[] arg, <element type>
list_element)
;
The push(<element type>[], <element type>)
function
accepts two arguments: the first is a list of any data type and the second is the data type of list element.
The function takes the second
argument and adds it to the end of the first argument.
The function returns the new value of the list specified as the first argument.
This function is alias of the append(<element type>[], <element type>)
function.
From the stack/queue point of view, push()
is much more natural.
<element type> remove(
<element type>[] arg, integer
position)
;
The remove(<element type>[], integer)
function
accepts two arguments: the first is a list of any element data type and the second is integer.
The function removes the element at the specified
position and returns the removed element. The list specified as the first argument changes its value to the new one.
(List
elements are indexed starting from 0.)
<element type>[] reverse(
<element type>[] arg)
;
The reverse(<element type>[])
function accepts one
argument of a list of any element data type. It takes this argument, reverses the
order of elements of the list and returns such new value of the list specified as the first argument.
<element type>[] sort(
<element type>[] arg)
;
The sort(<element type>[])
function accepts one
argument of a list of any element data type. It takes this argument, sorts the
elements of the list in ascending order according to their values
and returns such new value of the list specified as the first argument.