MTS 8: LISP and SLIP in MTS
June 1976
and
SEQSL(SRDR,IFLAG)
resemble ADVSER and ADVSEL, respectively. They never terminate on a
name cell; rather, they descend into the sublist. When they arrive at a
terminal sublist (i.e., one that has no more sublists), they assume the
role of the above two linear sequence functions, SEQLR and SEQLL, at
that level. Therefore, IFLAG can only be -1 for datum cells and +1 for
Header cells.
Recursion _________
Recursion is one of the most powerful techniques in list processing.
SLIP also has this facility although its level of elegance is well below
that of LISP.
Let us first consider a few subprograms.
The subroutine
PRESRV(N)
preserves (i.e., pushes down and duplicates) the top cell of the first
N(≤10) public lists, the Ws, which are described in the subsection
"Programming Conventions (SLIP with FORTRAN IV)."
The subroutine
RESTOR(N)
does the opposite. It deletes the top cell from each of the first
N(≤10) public lists.
The function PARMT has two similar forms of implementation. In our
version of SLIP
PARMT2(A,B)
places A and B on the top of the first two public lists, W(1) and W(2)
respectively.
However
PARMT(N,ARG)
puts the first N(≤10) arguments, ARG(1)...ARG(N), in the top cell of the
first N public lists. In both versions of PARMT, the returned value is
the new contents of W(1). If an attempt is made to put values on more
than the allowable public list an error comment is printed and the
program is terminated.
136 SLIP