Anonymous user
Arrays: Difference between revisions
added Ol
(added Ol) |
|||
Line 4,358:
[1, 8.1, 3]
</pre>
=={{header|Ol}}==
Ol provides arrays in the form of smart objects named vectors.
Vectors are heterogeneous structures whose elements are indexed by integers. A vector typically occupies less space than a list of the same length, and the average time needed to access a randomly chosen element is typically less for the vector than for the list.
The length of a vector is the number of elements that it contains. This number is a non-negative integer that is fixed when the vector is created. The valid indexes of a vector are the exact non-negative integers less than the length of the vector. The first element in a vector is indexed by one, and the last element is indexed by length of the vector.
<lang scheme>
; making an array
#(1 2 3 4 5)
; making an empty array
#()
#0
; making n-length array with undefined values (actually, #false)
(make-array 5)
; making n-length array with default value
(make-array 5 0)
; getting n-th element of array
(ref array 1)
</lang>
=={{header|ooRexx}}==
|