MTS 8: LISP and SLIP in MTS
Page Revised February 1979 June 1976
S is the value to be returned from LTR.
SW is a switch which determines what will happen to the rest of the
forms in the list, which would be iteratively evaluated if the LTR were
not present.
Value Meaning _____ _______
SW = NIL Do not evaluate any more forms. S is then
effectively the last value in the list.
SW = T Continue normally through the list.
SW = anything else In this case, SW must be a new list of forms,
which will be substituted for the rest of the
original list, and evaluation will continue.
Example:
(REM (READ) (LTR (READ) X) (READ))
If X is NIL, then the effect of this function is (REM (READ) (READ)).
If X is T, then the effect of this function is (REM (READ) (READ)
(READ)). If X is (S), then the effect of this function is (REM (READ)
(READ) S).
LTR stands for "list terminate or redirect."
(MTS A) _________
The MTS function, besides allowing the user to return to MTS with the
option to restart by calling (MTS), also allows execution of a single
MTS command, with an automatic restart. This allows the LISP programmer
(as distinct from the user of the program) to execute MTS commands
without the user’s knowledge.
A must be a literal atom or IOARG. The PNAME of the atom, or the
contents of the buffer associated with the IOARG, is executed as an MTS
command, and an automatic restart is performed.
MTS always returns NIL.
The Transport System ____________________
LISP incorporates a simple mechanism for creating and altering data
structures "hypothetically," for backing up to a previous state of the
data structures, and for maintaining several alternative structures at
once and switching back and forth among them.
80 LISP

MTS 8: LISP and SLIP in MTS
June 1976 Page Revised February 1979
This mechanism, called the transport system, is useful for LISP
implementations of problem solving, game playing, and automatic program-
ming algorithms.
If the state of all LISP structures at a particular moment is
considered to be a possible world, then the transport system allows the
user to obtain a "ticket" which will return him to that world at a later
time.
Within the transport system, there is always one unique world which
has the status of reality. This is the state of LISP structures before
any "hypothetical" changes have been made. A system of hypothetical
worlds can be pictured as a tree structure, with reality at the root.
World A dominates world B if the user started in world A and, by making
various hypothetical changes in his data structures, reached world B.
Thus, all worlds are dominated by reality.
The tickets which are created by the transport system are actually
| lists of alterations of a LISP structure. When the user returns to a
dominating world, the alterations he has performed are undone, or
reversed. If he returns to a world which does not dominate the world he
is currently in, alterations are reversed until the closest common
dominating world is reached, and then the alterations which were
performed to get to the desired world are repeated.
Creating Hypothetical Worlds:
All reversible alterations of a LISP structure must be made using
special functions defined for that purpose. These functions are
part of the transport system RESTORE package. When any function
that is part of the transport system is called, the entire system
is restored from *LISPLIB.
The functions listed below work exactly like the corresponding LISP
system functions except that the alterations they make to a LISP
structure are reversible.
The functions are:
RPLACA2 SETQ2
RPLACD2 SET2
GRAFT2 SETA2
DELETE2 PUT2
ADDPROP2 REM2
UNCONS2
Note: The functions MAPCAN and MAPCON do not have transport system
duplicates, even though they alter LISP structures.
(NEWWORLD T,NIL)
The NEWWORLD function has three uses. (NEWWORLD) returns a ticket
to the current state of LISP structure. By calling NEWWORLD, a
LISP 81
Previous Page Next Page