MTS 8: LISP and SLIP in MTS
June 1976
Before we consider the various operations in SLIP, several points
must be discussed.
Programming Conventions (SLIP with FORTRAN IV) ______________________________________________
A FORTRAN subroutine-type subprogram does not return values other __________
than those of the variables, either in COMMON or in the list of the
subroutine arguments. A function-type subprogram, on the other hand, ________
returns, in addition, a single value, that of its name, as if the name
were a variable. This represents the main programming advantage of
functions: they can be nested in arbitrary depth in the argument list
of other subprograms (no recursive calls). Further, a function can be _____
CALLed like a subroutine, in which case the returned value is, of
course, lost. Finally, the results of the processes in a subroutine can
be obtained by including the subroutine name in a FORTRAN arithmetic
statement as if it were a function. A function must always have at
least one dummy argument lest it be mistaken for a variable.
The FORTRAN mode conventions need to be explained. Many SLIP
subprograms disregard the mode of the subprogram arguments but they are
concerned with addressing conventions. To avoid unwanted conversions,
the functions REALS and INTGER may be used for the output of ill-named
functions. For example, as we will see later, the subprogram TOP(LST)
retrieves the datum of the top cell of the list with alias name LST.
The cell’s datum may contain a list alias. If TOP is called as a
function, it delivers the contents of the top cell as its value. If
this value is an integer, we do not want it to be converted into a
floating-point number. To avoid this we use assignment statement
I=INTGER(TOP(LST))
to obtain the integer stored in the datum. Similarly, the function
REALS (REAL-short) delivers the single-precision REAL value without
conversion.
Let us consider a significant difference between FORTRAN and SLIP.
In FORTRAN, we manipulate contents of words that have symbolic names.
For example, the instruction
A = B+C
adds the contents of the words with symbolic addresses B and C and
places the sum into a word with symbolic address A. In SLIP, both the
contents and the addresses of words can be operands.
The following notation will be used uniformly in the arguments of
SLIP subprograms.
118 SLIP