Go to the first, previous, next, last section, table of contents.


Vectors

Vectors are simple fixed-length, one-dimensional arrays. They are intended to provide a simple, flexible, space-efficient component from which muf programmers may build custom datastructures of various sorts. To this end, a vector contains an absolute minimum of overhead (a pointer identifying its owner), and hence provides a minimum of functionality: Just the ability to return its length, and to get and set the value of any slot.

As in C and Lisp, vector slots are numbered starting at zero.

Since vectors are subject to side-effects, they are compared by address rather than by contents.

As an efficiency hack, it is possible to allocate vectors on the stack rather than on the heap. Doing so avoids the need to garbage-collect them, and fits naturally into the paradigm of some languages like C; It also of course introduces the danger of the vector being recycles while references to it remain, and in the Muq implementation restricts access to the vector to the job creating the vector.


Go to the first, previous, next, last section, table of contents.