MTS 8: LISP and SLIP in MTS
Page Revised February 1979 June 1976
Command: F s
The F command finds the first occurrence, in print order, of an
element in the current expression which is EQUAL to the
S-expression "s". This element becomes the current expression. If
s is an atom, the F command is implicitly followed by an UP
command.
Examples:
.?
:(LAMBDA (X) (COND ((NULL X) NIL) (T (CONS X X))))
.F X ?
:(X)
.# F NULL ?
:(NULL X)
.# F COND ? F X ?
:(COND ((NULL X) NIL) (T (CONS X X)))
:... X)
.!0 ?
:(NULL X)
.UP UP ? F CONS ?
:... ((NULL X)NIL) (T (CONS X X)))
:(CONS X X)
.# F (NULL X) ?
:(NULL X)
COMMANDS THAT MODIFY THE CURRENT EXPRESSION ___________________________________________
All of these structure-modifying commands require a location specifi-
cation to determine the element(s) to be modified. This location
specification must be a sequence of S-expressions, where each
S-expression is either:
(1) Any command (except F) from the above subsection, or
(2) Anything else, in which case an F command is implied with the
S-expression as argument.
These location specification "commands" are executed in the order
specified, beginning with the current expression, to determine the
expression to be modified. However, the location specification does not
determine a new current expression. A location specification is
indicated in the following subsection by "p1...pn" or "q1...qn".
Since all of the commands in this subsection, except EMBED, are of
variable length, they must be followed by a colon if further commands
are entered on the same line.
94 The LISP Editor

MTS 8: LISP and SLIP in MTS
June 1976
Command: INSERT s1...sn {BEFORE|AFTER|FOR} p1...pn
The INSERT command, which may be abbreviated to I, inserts the
sequence of S-expressions "s1...sn" before, after, or in place of,
the element determined by the location specification "p1...pn".
Examples:
.?
:(LAMBDA (X) (COND ((NULL X) NIL) (T (CONS X X))))
.INSERT (A B C) AFTER X : ?
:(LAMBDA (X) (A B C) (COND ((NULL X) NIL) (T (CONS X X))))
.INSERT B BEFORE X 1 : ?
:(LAMBDA (B X) (A B C) (COND ((NULL X) NIL) (T (CONS X X))))
.F NULL ? INSERT B FOR X : ?
:(NULL X)
:(NULL B)
.INSERT ABC D AFTER B : ?
:(NULL B ABC D)
Command: DELETE p1...pn
The DELETE command removes the element designated by "p1...pn" from
the structure. This command may be abbreviated to D.
Examples:
.?
:(LAMBDA (Q X) (A B C) (COND ((NULL X) NIL) (T (CONS X X))))
.DELETE Q 1 : ?
:(LAMBDA (X) (A B C) (COND ((NULL X) NIL) (T (CONS X X))))
.DELETE (A B C) : ?
:(LAMBDA (X) (COND ((NULL X) NIL) (T CONS X X))))
.DELETE NIL ?
:(LAMBDA (X) (COND ((NULL X) (T (CONS X X))))
Command: EMBED p1...pn IN s
The EMBED command replaces every occurrence of the atom "*" in the
S-expression "s" with the element designated by "p1...pn", and then
replaces the element designated by "p1...pn" with the result. The
EMBED command may be abbreviated to EM.
The LISP Editor 95
Previous Page Next Page