Vector
Vector is a finite ordered set of objects.
Notation of vector is a list of elements inside brackets
Examples:
A vector of 1 element is treated as the one element, that it contains.
Therefore, brackets
And also, vector itself can be handled as an object:
Linear form
When a vector is created, it is always converted to linear form,
that is, when some elements are also vectors, then the main vector will be created from its elements
(in other words, the vectors will be separated into elements).
Examples:
Notice that arrays, unlike vectors, are not being converted to linear form, and they keeps order of elements and subarrays (see Arrays).
Accessing elements
Once created vector cannot be changed. There are no methods for changing elements of vectors.
Only reading is possible through methods of vector object (see below).
Operators
Operators applied on vectors will be applied to its coordinates (elements), and the result will be a vector of results from coordinates.
Operator
Methods
Methods accepted by the vector object:
method | parameters | description | result |
length | () | length of vector | |
get | (pos) | returns element at given position | |
subVector | (pos,count) | returns new subvector starting at given position | |
toArray | () | returns new array containing elements from the vector | |
iterate | (fun) | iteration - sequential function call for each element in the vector | vector of results |
Examples of use: