previous | index | next

Vectors (Section 11.6)

(make-vector size)
Returns a chunk of memory of length size, where the first location is numbered 0 (zero-origin).

(vector-length v)
Returns the size of vector v.

(vector-ref v loc)
Returns the contents of location loc in vector v.

Because the numbering is zero-origin, if you want the nth physical location, you must use n-1 to refer to it.

(vector-set! v loc val)
Puts val into location loc of vector v.

This procedure has a ! after its name (as a convention) because it alters (clobbers) the state of memory.


previous | index | next