MTS 8: LISP and SLIP in MTS
June 1976
deleted. The purpose of this function is to eliminate any circularity
within a list structure, such as cross-referencing and self-referencing.
If the programmer does not wish to thus modify a list structure, but
still wishes to process each element on it, he can make a copy of the
list structure and subject the copy to LPURGE before processing. A
similar technique employs marking of processed sublists and final
unmarking at the end. See Findler, Pfaltz and Bernstein (4).
Adding Cells and Data to Lists ______________________________
Most of the subprograms here appear in pairs because of the symmetric
nature of SLIP lists.
NXTLFT(X,CADR)
or
NXTLFT(X,MADR)
and
NXTRGT(X,CADR)
or
NXTRGT(X,MADR)
are functions that insert a new cell to the left and right, respective-
ly, of the cell with name CADR or MADR. The contents of X are then
placed into the datum word of the inserted cell. When these routines
are called as functions, the delivered value is the name of the newly
inserted cell, an integer.
For example
IDUM=NXTRGT(LIST(9),LIST(L1))
creates a list with alias L1 and puts on it the name of an empty
sublist. The functions
NEWTOP(X,LST)
and
NEWBOT(X,LST)
add a new cell to the top and bottom, respectively, of the list with
alias LST and put the contents of X into the datum of the new cell. The
remarks made concerning the previous two routines also apply here.
These functions perform the push-down operation with the piece of datum
122 SLIP

MTS 8: LISP and SLIP in MTS
June 1976
X at either end of the named list. As can be seen, none of the original
cells are shifted in the memory. Therefore, the terms push-down and,
similarly, pop-up must be interpreted accordingly.
The datum of the top and bottom cells, respectively, can be replaced
(as opposed to the preserving push-down operation) by the functions
SUBSTP(X,LST)
and
SUBSBT(X,LST)
The remarks made above concerning NXTLFT and NXTRGT are valid here, too,
except that the returned value, when SUBSTP or SUBSBT is called as a
function, is the old contents of the cell being overwritten with X.
The function
SUBST(X,CADR)
replaces the contents of the datum of the SLIP-cell, of cell name CADR,
with the contents of X. The returned value is the old contents of the
cell.
Another REAL function, STRDAT, has a similar purpose; it is invoked
by
RDUM=STRDAT(X,CADR)
and RDUM will contain the value of X upon return.
Block insertions are performed by the functions
INLSTR(LST,CADR)
and
INLSTL(LST,CADR)
They decapitate the list LST (i.e., leave its Header as an empty list)
and insert the rest of the list to the right and left, respectively, of
the cell with name CADR.
Retrieving Data from Lists __________________________
Two types of operations fall into this category. Data can be
accessed either without changing the list or coupled with destroying
(i.e., returning to the Available Space List) the cell that contains the
information being retrieved. Accordingly, the functions
SLIP 123
Previous Page Next Page