MTS 8: LISP and SLIP in MTS
June 1976
Ignoring dotted pairs for the moment, any proper subexpression of a
LISP expression (hence any current expression) must be one of the
following:
(1) An atom.
(2) A list which is an element of some higher level list.
(3) A proper sublist, which will be referred to as the tail of a ____
list.
For example, given the expression (A (B C) D), the atoms are A, B, C,
and D; the list (B C) is an element of the top-level list; the tails of
(A (B C) D) are ((B C) D) and (D); and the tail of (B C) is (C).
Dotted pairs (expressions whose CDR are atoms other than NIL) have
not been adequately described, and indeed, the behavior of the editor is
erratic at best when it encounters a dotted pair.
For the purpose of this description, editor commands are divided into
five major groups: printing commands, commands specifying the current
expression, commands modifying the current expression, commands undoing
previous modifications, and miscellaneous commands.
COMMANDS THAT PRINT THE CURRENT EXPRESSION __________________________________________
Command: P [n]
The P command prints the current expression up to level "n". The
optional argument n defaults to 2. To avoid excessive output,
lists at level n are printed as the character ampersand (&). A
current expression which is a tail of some list is indicated by
ellipsis marks (...) preceding the expression.
A P command is assumed at the end of every line unless a P, ?, or
PP command is the last command on the line.
Command: ?
The ? command is equivalent to a P 1000 command; it effectively
prints the entire current expression. This command is used in most
of the examples in this section.
Command: PP
The PP command also prints the entire current expression, but in an
indented format which makes the structure more clearly visible.
The PP command does not print ellipsis marks for tails of lists.
90 The LISP Editor

MTS 8: LISP and SLIP in MTS
June 1976 Page Revised February 1979
Examples:
.?
:(LAMBDA (X) (COND ((NULL X) NIL) (T (CONS X X))))
.P
:(LAMBDA (X) (COND & &))
.P 3
:LAMBDA (X) (COND (& NIL) (T &)))
.PP
:(LAMBDA (X)
: (COND ((NULL X) NIL)
: (T (CONS X X))))
COMMANDS THAT SPECIFY THE CURRENT EXPRESSION ____________________________________________
Command: [±]n
A positive integer "n" or "+n" selects the nth element of the
current expression, counting from the left, and makes it the
current expression. A negative integer "-n" operates in the same
manner except that it counts from the right. Users should note
that zero is a separate command, described later in this section.
Examples:
.?
:(LAMBDA (X) (COND ((NULL X) NIL) (T (CONS X X))))
.3 ?
:(COND ((NULL X) NIL) (T (CONS X X)))
.2 1 ?
:(NULL X)
Command: UP
If the current expression is an element of a higher-level list, the
UP command specifies the tail of the higher-level list beginning
with the current expression, as the new current expression.
Otherwise, the UP command has no effect. Note that if the current
expression is the first element of a higher-level list, the UP
command produces the entire list, rather than just a tail of the
list.
Examples:
.?
:(LAMBDA (X) (COND ((NULL X) NIL) (T (CONS X X ))))
.3 ?
| :(COND ((NULL X) NIL) (T (CONS X X)))
The LISP Editor 91
Previous Page Next Page