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