==[[Ol]]==
Code moved to [http://rosettacode.org/wiki/Arrays#Ol Arrays].
There are two type of [numerical indexed] arrays in Otus Lisp. The vectors and tuples.
Vectors can by byte-vectors (aka raw vectors), and regular vectors.
Byte-vectors do access to elements by integer index started from 0. Vectors and tuples do access to elements by integer index started from 1.
<lang ol>
;; vector
(define v (vector 1 2 3 4 5 6 7 8 9))
(print v)
; ==> #u8(1 2 3 4 5 6 7 8 9)
(define vx (vector 9999999999 8888888888))
(print vx)
; ==> '#(9999999999 8888888888)
(print (ref v 3))
; ==> 4
(print (ref vx 2))
; ==> 8888888888
(print (byte-vector? v))
; ==> #true
(print (byte-vector? vx))
; ==> #false
</lang>
<lang ol>
;; tuples
(define t (tuple 1 2 3 4 5 6 7 8 9))
(print t)
; ==> #[1 2 3 4 5 6 7 8 9]
(print (ref t 7))
; ==> 7
</lang>
==[[Pascal]]==
|