MTS 8: LISP and SLIP in MTS
Page Revised February 1979 June 1976
state becomes a reachable world in the transport system. For
example, (SETQ EARTH (NEWWORLD)) saves the ticket as the VALUE of
EARTH. (NEWWORLD T) returns a ticket to reality. This is provided
in case the user wishes to return to reality, but has not saved a
ticket to get there. (NEWWORLD NIL) returns a ticket to the
closest reachable world which dominates the current state. NEW-
WORLD does not cause a transfer to any other world. Its purpose is
to create tickets.
(GETWORLD S)
The GETWORLD function performs the transportation in the system.
Its argument must be a valid ticket (an error will be generated if
not), and it causes a transfer to the world identified by that
ticket. For example,
(GETWORLD EARTH)
(REALWORLD)
REALWORLD, the most amazing function of all, takes the current
state of LISP structure, and causes it to become reality. What was
once reality is now lost forever, and all previously created
tickets will no longer be valid.
| The LISP Compiler: (COMPILE A1...AN) _____________________________________
For each atom Ai, the LISP compiler finds the EXPR property on its
PLIST and, if it is a LAMBDA-expression, translates it into machine code
to perform the same computation. This machine code program, in the form
of a LISP "SUBR atom," is put on the PLIST of the atom Ai under the
appropriate indicator (SUBR for LAMBDAs, NSUBR for NLAMBDAs, FSUBR for
FLAMBDAs), and the EXPR property is removed.
COMPILE is an FLAMBDA function which takes its arguments unEVALed.
When COMPILE is called, the compiler will be loaded automatically
from *LISPLIB. Evaluating the form (=EXCISE) will remove it.
Compiler Features
Declarations--(DECLARE A,LA IND PVAL)
The function DECLARE, an NSUBR, is used to control the various
compiler options described below. The arguments to declare
take the form:
(DECLARE A,LA IND PVAL)
82 LISP

MTS 8: LISP and SLIP in MTS
June 1976
where the property IND with property value PVAL (or T if PVAL
is omitted) will be put on the PLIST of the atom A or the
atoms in LA. For example, (DECLARE (A B) =SPECIAL)
Declarations may be made before compiling a function, or may
be made during the process of compilation by inserting a
(DECLARE...) as a top level form of a LAMBDA or PROG. The
declaration will not cause any code to be produced, and will
be in effect until it is overridden by another declaration.
Variable Types
Normally, a variable which occurs as an argument, a PROG
variable, or a LAMBDA-variable within a compiled function is
assumed to be local to that function. Its value is set when
the variable is first bound, and may be changed using SETQ or
UNCONS, but the variable has no relation to the LISP atom of
the same name. However, if such a variable is declared to be
special: (DECLARE X =SPECIAL) all references to it are
assumed to refer to the LISP atom of that name, and the value
of the atom will be updated accordingly.
References to variables which are not arguments, PROG varia-
bles, or LAMBDA-variables (i.e., FREE variables), are assumed
to refer to LISP atoms in the usual way. Warning: All
references to atoms which occur in QUOTEd expressions, includ-
ing the arguments to N-type and F-type functions that are
implicitly QUOTEd, will refer to LISP atoms and not to local
variables of the same name. A user who wants to pass a local
variable to an FSUBR must APPLY the FSUBR, or declare the
variable to be special.
Setting the variable =SPECIAL to T causes all variable
references to be compiled as if the variable had been declared
=SPECIAL.
Function Types
All external functions called by compiled programs are assumed
to be SUBR or LAMBDA-type EXPRs unless they are declared
otherwise. The function-type declarations which are available
are:
(DECLARE F =TYPE FLAMBDA)
for FSUBRS or FLAMBDA-type EXPRs,
(DECLARE G =TYPE NLAMBDA)
for NSUBRS or NLAMBDA-type EXPRs, and
(DECLARE H =TYPE =ARRAY)
LISP 83
Previous Page Next Page