MTS 8: LISP and SLIP in MTS
June 1976
(1) Access the kth element (1kn).
(2) Insert a new element before or after the kth.
(3) Delete the kth element.
(4) Concatenate (i.e., chain together) two or more simple lists.
(5) Split a list into two or more lists.
(6) Make a copy of a list in terms of its contents and structure.
(7) Count the number of elements on a list.
(8) Sort the elements according to some criterion; for example, in
ascending order of the integers in a given field of the
elements.
(9) Search for an element that has a particular value.
Special reference is usually made either to the first (top) or the
last (bottom) element (i.e., when k=1 or k=n). There is even a
particular terminology dealing with list processing: inserting a new
element to the top is called pushing down the list, and deleting an
element from the top is called popping up the list. Although these
terms are completely acceptable in automata theory, they may be
misleading in programming, as we will see later, since the elements
below the top element do not in fact change location.
To achieve ease and flexibility in the above-mentioned nine basic
operations, the usual sequential structure of the memory, as in FORTRAN,
must be given up. In other words, elements that are consecutive
logically on the list may not be consecutive geometrically in the
computer hardware memory. Nothing is novel about this. For example,
when we store the elements of a two-dimensional array column-wise, the
row-wise neighboring elements are no longer adjacent in the essentially
one-dimensional memory. However, if we know the location of the first
element, the dimensions of the array, and the so-called mapping function
(i.e., the algorithm of storing the array), we can easily determine the
geometrical location of any element. Some similar arrangement is needed
in the case of lists, and the solution is provided by links or, using
another term, by pointers. A part of the space representing the list
element is occupied by the name of the next element. This name field
links with, or points to, the neighboring element, which in fact may be
in any part of memory.
Let us now consider one more concept, that of the Available Space
List for free storage, before seeing how the nine basic operations are
carried out. The Available Space List is essentially a reservoir of
free space from which we draw when a new cell is needed and to which we
return cells no longer needed, in order not to run out of free space too
soon. Similarly, the SLIP system can automatically draw cells from or
return cells to this reservoir. This dynamic memory allocation enables
us to omit specifying in advance how long a list is going to be. In
fact, we can create, change the size of, and erase lists during
execution time.
The importance of the Available Space List cannot be overemphasized,
particularly in nonnumeric computations.
112 SLIP