|Page 219 of 800||Search internet|
We shall refer to an array as homogeneous if all values in the array are of the same kind. The definition is vague but nevertheless convenient for informal use.
We shall refer to an inhomogeneous array as a rack and to the elements of the domain of a rack as hooks. As an example, the array
Recall that strings are represented by naturals so they work fine as array indexes. The rack above has hooks 'name', 'born', and 'alive', and the value 'Bach' hangs on the 'name' hook.
The hooks of a rack need not be strings. Any integers can be used as hooks.
Racks may be used in places where one uses record structures in traditional languages. Like for other arrays, one does not need to declare a rack and one can add whichever hooks one wants on the fly.
Note that array and rack indexing in Logiweb is slower than array and record indexing in languages like C. For lots of applications, the time spent on indexing is negligible. But there are cases where one has to resort to other data structures like lists for efficiency reasons. As an example, a data structure which just consists of three, particular items is most efficiently represented by a three element list.
|Page 219 of 800||Search logiweb.eu|