0% found this document useful (0 votes)
7 views53 pages

ALPHLISP Users Reference May1980

The document provides an important notice for LISP users regarding enhancements in AMOS Release 4.4, including improved error handling and new functions like RETFROM, BREAK, and UNBREAK. It outlines the functionalities of these new features, such as better error reporting and the ability to set breakpoints in programs. Additionally, it includes a preface and introduction to AlphaLisp, detailing its data types and demonstration library.

Uploaded by

caacuca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views53 pages

ALPHLISP Users Reference May1980

The document provides an important notice for LISP users regarding enhancements in AMOS Release 4.4, including improved error handling and new functions like RETFROM, BREAK, and UNBREAK. It outlines the functionalities of these new features, such as better error reporting and the ability to set breakpoints in programs. Additionally, it includes a preface and introduction to AlphaLisp, detailing its data types and demonstration library.

Uploaded by

caacuca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

Mi'lY 1980

IMPORTANT NOTICE FOR LISP USERS

Several new functions and enhancements have been added to LISP in AMOS
Release 4.4. These features include improved error reporting and the
addition of functions to the Extended Library to handle breakpoints.

1.0 ERROR HANDLING

When LISP reports an error, it now displays the user function in which the
error occurred. For example:
* (DE DOUBLE (X) (PLUS XX»
DOUBLE
*(DOUBLE 2)
UNBOUND VARIABLE - EVAL IN DOUBLE
=========
-XX
*

2.0 NEW FUNCTIONS

Three new functions have been added to LISP: RETFROM, BREAK, and UNBREAK.
In addition, we have added the variable BREAKFNS (which is maintained by
BREAK and UNBREAK).

2.1 RETFROM

The calL (RETFROM fn vaL) causes the most recent caLL of function fn to
return with value vaL. If the specified function is not active~LISP
generates an error message. For example:
*(DE F1 (X) (PROGN (F2) X»
F1
*fDE F2 () (RETFROM @F1 5) )
F2
*fF1 7)
5"
NOTE: The caLL (RETFROM PROG vaL) behaves exactLy the same as (RETURN vaL).
IMPORTANT NOTICE FOR LISP USERS Page 2

2.2 BREAK (added to the Extended Library)

The call (BREAK fn1 fn2 ••• ) causes execution of a program to be interrupted
if an attempt is made to call any of the specified functions. You may then
single-step execution of the interrupted function by typing a line-feed, or
resume execution by typing (RESUME). NOTE: fn1, fn2, are not
evaluated.

2.3 UNBREAK (added to the Extended Library)


The call (UNBREAK fn1 fn2 ••• ) restores the specified functions so that they
no longer interrupt program execution when called. (That is, this function
clears breakpoints set via the BREAK function.) NOTE: fn1, fn2, ••• are not
evaluated.

2.4 BREAKFNS (added to the Extended Library)

BREAKFNS is a variable which contains a list of all functions which will


interrupt program execution when called. BREAKFNS is maintained by BREAK
and UNBREAK; therefore, you should not directly modify this variable. (See
BREAK and UNBREAK, above.)
~ MICROSYSTEMS AM-100

ALPHALISP ~AGE PRCX;RAr+1IN; SYSTEM

USER'S REFERENCE MANUAL

ALPHA MICROSYSTEMS
17875 Sky Park North
Irvine, CA 92714
'AMOS', 'AlphaBasic', and 'AM-100'

are trademarks of products


and software of

ALPHA MICROSYSTEMS
Irvine, CA 92714

© 1977 - ALPHA MICROSYSTEMS

ALPHA MICBOSYSTEMS
17875 Sky Park North
Irvine, CA 92714
Table of Contents

PREFACE
CHAPI'ER 1 INTRODUCTION
1.1 OPERATING INSTRUCTIONS 1-1
1.1.1 System Files 1-1
1.1.2 O};:leration ....................•........•.•.. 1-2

CHAPTER 2 DATA TYPES


2.1 NUmERS .•....••...••.•.•.•••.....••.••••... 2-1
2.1.1 Fixed Point Small Integers 2-1
2.1.2 Floating Point Numbers ••••••••••••••••••••• 2-2
2.2 CHARA.CTER STR.INGS •••••••••••••••••••••••••• 2-2
2.3 LITERAL ATOMS 2-2
2.4 LIS'I'S •••••••...•••.•••.•.••.•••.•••.••••••. 2-2

CHAPrER 3 DEMONSTRATION LIBRARY


3.1 IXlC'IOR ••••••••••••••••••••••••••••••••••••• 3-1
3.2 DIFF ...•....•....•...••••..••••••.•••.•.•.. 3-2
3.3 ILISP ...................................... 3-3
3.4 ~EDR ••••••••••••••••••••••••••••••••••••• 3-3

CHAPTER 4 SUMMARY OF PERMANENT SYMBOLS


BIBLICX;RAPHY
Preface
Version 1.1 of AlphaLisp corrects the following problems found in Version 1.0:
1. The function PUTPROP (and hence DE, DF, and OM) did not properly detect
an attempt to redefine a permanent function. Redefining a permanent
function could result in system failure.
2. The predicate MINUSP (and hence LESS, GREAT, etc) did not properly test
the sign of a Floating Point number.
3. The function VCONC, which returned a list built by TCONC or LeONC,
caused system failure if used ~properly. This has been corrected at a
slight expense in efficiency of the function.
4. The function TTYECHO, which was disabled in the change over to moni tor
2.0, has been re-enabled.

Version 1.1 contains the following minor enhancements:


1. The automatic conversion of input from lower to upper case letters has
been turned off. This allows the use of lower case in messages and
input. ** NOTE ** Built in identifiers must be entered in UPPER CASE'
in order to be recognized!
2. The OUTPUT function previously returned the error 'FILE ALREADY EXISTS'
if an attempt was made to create an output file which was already
present. OUTPUT now supersedes (ie. pre-deletes) any existing file.

Finally, a table of contents and bibliography have been added to this manual to
~rove its usefulness.

Sincerely,

Paul Allen Edelstein


Alpha Microsystems
CHAPI'ER 1

This manual sumarizes the features and operation of AlphaLisp, a version of the
programnirg larguage LISP. The reader is assumed to be already familar with
LISP, or to have available an introductory text such as the LISP 1.5 PRIMER by
Clark Weissman (Dickenson Publishirg Co., 1967) or PROGRAMMING LANGUAGE LISP:
Its Operation and Applications, edited by Edmund C. Berkeley and Daniel G.
Bobrow (The M.l.T. Press, 1966).
AlphaLisp is based on UCI LISP, which in turn is based on Standford Ar tificial
Intelligence Project's LISP 1.6 (Standford's LISP is documented in STANDFORD
ARI'IFICIAL INl'ELLIGENCE IABORA'IORY OPERATING IDTE 28. 6, STANDFORD LISP 1. 6
MANUAL, by Lynn H. Quam and Whitfield Diffie).

1.1 OPERATING INSTRUCTIONS

1.1.1 System Files


In order to use AlphaLisp, the following files must be present:
1. DSKO:LlSP.PBG[1,4]
2. DSKO:LISP.LSP[7,4]
The AlphaLisp language processor, LISP.PRG is re-entrant and can be made part of
the system by includirg it in a SYSTEM command in the file DSKO:SYSTEM.INI[1,4]
(See AMOS Operator's Manual).
INTroOOCTION 1-2

1.1.2 Operation

AlphaLisp is entered by typing:

• LISP

to which the system responds:

• LISP
WAD EXTENDED LIBRARY?

at this point, the user enters either Y for YES or N for 00 and presses the
return key. If the user responds yes, several extended features will be loaded
at the expense of memory space.

If the user has a file INIT.15P, this file will be automatically loaded at this
time. AlphaLisp will then print the following:

• LISP
WAD EXTENDED LIBRARY?Y
"AlphaLisp 1.6 Version 1.0"
*
The star (*) indicates that AlphaLisp is awaiting a command or data, and is
referred to as a P:ocMPI'.

The user may now enter any commands he wishes, for example:

*5
5
*(ADD 2 3)
5
*(MOL (ADD 3 4) 2}
16 (note: numbers are in octal)
* (DE FACI'ORIAL (N)
* (COND «ZEROP N) 1}
* (T (MOL N (FAcroRIAL (SUBl N}}}}})
FAcroRIAL
* (FAcroRIAL 3)
6
*(SETQ VAR @(A Be»
(A B e)
* (CAR VAR)
A
* (CDR VAR)
(B e)
*
When the user wishes to return to the monitor, he enters (EXIT):
IN'rIDruCTION 1-3
* (EXIT)

If the user wishes to abort output, cancel input, or interrupt program


execution, he enters CTRt/C (C):

*(SE'IQ X 1)
1
* (PROG () roop «ONEP X) (GO ImP»)
"c
INTERRUPI'
(GO ImP)
*
The program can then be single stepped by typing line-feed (Lf) or resumed by
entering (RESUME):

* (Lf)
INTERRUPI'
«ONEP X) (GO rooP»
* (Lf)
INTERRUPT
(ONEP X)
* (Lf)
INTERRUPI'
X
* (Lf)
INTERRUPI'
(GO rooP)
*(SE'IQ X 0)
o
* (RESUME)
NIL
*
CHAPI'ER 2

DATA TYPES

There are five types of data in AlphaLisp:


1. FIXed Point small integers (-2~13 thru 2~13).

2. FLOATing Point exponential reals (11 digit accuracy) •


3. Character STRINGS.
4. Literal Atans.
5. Lists.

2.1 NUMBERS
There are two types of numbers, small integers and floating point numbers.
AlphaLisp autanatically performs conversion between these two types whenever
possible to minimize storage requirements.

2.1.1 Fixed Point Small Integers


A small integer is a number between -2~13 and 2~13. When entered, it is
interpreted as a number in the radix specified by IBASE, which is initially set
to 8. If an integer is entered followed by a decimal po:tnt, is interpreted as a
decimal (radix 10) integer. Integers can optionally be preceed by a plus (+) or
minus (-).
Small integers are represented internally as special illegal addresses, and
hence require no additional storage space when contained in a list.
DATA'lYPES 2-2
2.1.2 Floating Point Numbers
Floating Point numbers are maintained to an accuracy of 11 digits. They may be
entered with a decimal point (such as 3.2, .1, -.09, etc.) or in scientific
notation (IE3=IOOO, 23.45EI=234.5, 23.45E-I=2.345, etc.).

2.2 CHARACTER S~S

Character Strings are any sequence of characters including special characters


such as carriage-return or line-feed, enclosed between a pair of double quotes
("). [buble quotes may appear within a string by entering them twice (e.g., "HE
SAID ""WHAT"" AND TURNED") •
When character strings are read in, they are not INTERNed on the OBLIST (entered
into the symbol table), and are initialized to their own value, unlike
identifiers which are initially unassigned.

2.3 LITERAL ATOMS


Literal atoms (or Identifiers) are a sequence of alphanumeric characters
beginning with a non-numeric character, such as A, ALPHA, COUNT,
VERYBIGIDENTIFIER, VI, etc. Literal atoms may include special characters such
as blank, dot, parentheses, etc., if these characters are preceeded by a slash
(I). When this is done, these characters are referred to as slashified (e.g.,
THISI IS/ONEI IDENTIFIER, 1123, AI.B, etc.).

2.4 LISTS
Lists are composed of a sequence of data elements including other lists,
enclosed between a pair of parentheses (e.g., (A B C), (A (B C) D), (1 2 1.7
"HELI.O" ID), etc.).
A special kind of two element list referred to as a dotted pair, has the form
(left part. right part). Note that the two elements are separated by a dot
(.). The CAR of a dotted pair is the left part, the CDR of a dotted pair is the
right part.
On entry, brackets can be used instead of parentheses
II [ ] II A close
II ( ) " .

bracket "] will automatically match an open bracket If [If at any time, producing
II

implicit close parentheses If) if necessary.


II

On entry, a double ALTMODE or ESC can be used to terminate an object being


entered at any time, producing implicit close parentheses ") if necessary.
II
CHAPl'ER 3

DEMONSTRATION LIBRARY

Included with AlphaLisp is a demonstration library composed of the following


files:
1. OOC'IDR
2. DIFF

3. ILISP

4. METEOR

3.1 OOC'IDR
OOC'IDR is a program which lirnnitates a psychiatrist who is holding a session with
the user. To load doctor, enter:
.LISP
WAD EXTENDED LIBRARY?N
"AlphaLisp 1.6 Version 1.0"
* (DSKINOOC'IDR)
(Wait about one minute for OOC'IOR to be loaded and processed)
NIL
* (w)RKER)
*HELID.
*
HOW 00 YOU 00, PLEASE STATE YOUR PROBLEM

*MY NAME IS PAUL.


*
DEMONSTRATION LIBRARY 3-2

I AM NOr INTERESTED IN NAMES

*
DOCTOR is an extremely large program and requires a machine with 56K of memory.
Be sure your job has all of the system's memory when you try to load doctor, am
that no systems such as BASIC have been loaded into the resident monitor by
SYSTEM.IN! with the possible exception of LISP itself. If insufficent space
exits, you will receive the error message:

WORKSPACE FULL

*
Whenever you tell the IXX:'IOR something, be sure to terminate your text with a
blank line so that the DOCTOR knows you are finished speaking.

To leave IXX:'IOR, type a C1'RL/C C"'C) and then enter (EXIT):

INTERRUPT
(TYI).
* (EXIT)

3.2 DIFF

DIFF is a program which performs symbolic differentiation (That's calculus in


case you've forgotten). To load DIFF, enter:
•LISP
roAD EXTENDED LIBRARY?Y
"AlphaLisp 1.6 Version 1.0"
* (DSKIN DIFF)
(Wait about 30 seconds)
NIL
* (DIFF)
THE DERIVATIVE OF-

*3X"" 3

wrm RESPECT 'IO-

*X

IS-
9 X""2
DEMONSTRATION LIBRARY 3-3

THE DERIVATIVE OF-

INTERRUPI'
(READCH)
* (EXIT)

DIFF is documented in the LISP 1.5 PRIMER by Clark Weissman.

3.3 ILISP

ILISP is the incremental language processor presented by L.A. lombardi and


Bertram Raphael in the paper "LISP as the LaIl3uage for an Incremental Canputer"
in the book PROGRAMMING LANGUAGE LISP, edited by E. Berkeley. To load ILISP,
enter:

.LISP
WAD E}cr'ENDED LIBRARY?Y
"AlphaLisp 1.6 Version 1.0"
* (DSKIN ILISP)
(Wait a while)
NIL
*(GRINDEF SUBST1)
(DEFPROP SUBsrl
(LAMBrA (X Y Z)
(COND «A'IOM Z) (COND «EQ Z Y) X) (T Z}»
(T (CONS (SUBsrl X Y (CAR Z)}
(SUBSTl X Y (CDR Z»»}}
EXPR)
* (EVALQUOTEl @SUBST1 @«A B) C NIL*})
(LAMBDA (G3)
(COND «A'lOO G3) (COND «EQ G3 @C) @(A B» (T G3»)
(T (CONS (SUBsr1 @(A B) @C (CAR G3»
(SUBST1 @(A B) @C (CDR G3»»»
* (EXIT)

3.4 METEOR
METEOR is a progrannning language written in LISP by Daniel G. Bobrow and
documented in the article "METEOR: A LISP Interpreter for StriIl3
Transformations" which appears in the book PROGRAMMING IANGUAGE LISP, edited by
E. Berkeley. To load METEOR, enter:
DEMONSTRATION LIBRARY 3-4

• LISP
WAD EXTENDED LIBRARY?Y
"AlphaLisp 1.6 Version 1.0"
* (DSKIN METEOR)
(Wait a while)
NIL
*WS123
(A roSE IS A roSE IS A rosE)
*TEsr1
«* (roSE) (FIOOER) * (SIMPLE REPLACEMENT»
(* «*P THE WORKSPACE IS» * (DEBOO PRINTOUl'»
(* (IS A rosE) 0 * (DELETION»
(* (A FLOWER IS) (3 1 2) * (REARRANGEMENT»
(* «*P WS2» *)
(* (FWWER) (1 OF RED) * (INSERTION»
(* (A FIDWER) (THE 2) * (REPLACEMENI' IN CON'IEXT»
(* «*P WS3» *)
(* (FlOWER) * (N) OPERATION»
(* (RED) (1 1) * (DUPLICATION»
(* «*P WS4» *)
(* (OF ($ 1» (1) * (SINGLE UNKNaiN CONSTITUENT»
(* «$ 1» (QUESTIOO 1) * (FIRST CONSTITUENl'»
(* «*P WS5» *)
(* «$ 2) FWWER ($ 3»
(3 2 1)
*(N
CONSECUTIVE CONSTITUENTS»
(* «*P WS6» *)
(* (~R $ roSE) (1 3) * (UNKNCMN NUM OF CONSTITUENTS»
(* «*P WS7» *)
(* ($) (START CAB D) * (REPLACING ENTIRE IDRKSPACE»
(* (STAR!' ($ 1) $ D) (1 3 2 4) *)
(* «*P WS8» *)
(* ($) END»
* (METEOR TEST1 WS123)
(THE WORKSPACE IS)
(A ~ IS A rosE IS A rosE)
(WS2)
(IS A ~R A rosE)
(WS3)
(IS THE ~ OF RED A roSE)
(WS4)
(IS THE FIDWER OF RED RED A rosE)
(WS5)
(QUESTION IS THE FLOWER OF RED A roSE)
(WS6)
(QUESTION OF RED A FI.aiER IS THE rosE)
(WS7)
(QUESTION OF RED A FI£MER rosE)
(WS8)
DEMONSTRATION LIBRARY 3-5
(STARr ABC D)
(STARr ABC D)
* (EXIT)

Note that due to differences between AlphaLisp and LISP 1. 5, the following
changes were made to METEOR:

1. The form ($.n) has been change to ($ n).

2. Slashes (/) have been changed to backslashes (\).


CHAPI'ER 4

SUMMARY OF PERM.~ENl' SYMBOIS

In the following summary, calling sequences to LISP functions are presented in


S-expression form, with the CAR of the S-expression being the name of the
function. An argument to a ftmction is evaluated tmless that argunent is
surrounded by quotes (It) in the calling sequence definition presented. Quotes
here mean that the function implicitly QUOrEs that argument.

Several definitions refer to file specs. A file spec here refers to a standard
AMOS file specification (Refer to AMOS OPERATORS MANUAL, Standard File
Specification Format). If the file spec includes special characters, it should
be enclosed in quotes.

4.1 ABS
The call {ABS X} returns the absolute value of X, i.e., if X )= 0 then (ABS X)
is X: otherwise, if X < 0 then (ABS X) is (MINUS X) •

4.2 ADD
The call (ADD X Y) returns X+Y.

4.3 ADDI
The call (ADDI X) returns X+l.
SUMMARY OF PERMANENT SYMBOLS 4-2
4.4 AND
The call (AND X[l] X[2] ••• X[n]) returns the value of X[n] if all XCi] are
non-NIL, otherwise it returns NIL. AND evaluates its arguments fran left to
right until either NIL is found in which case the remaining arguments are not
evaluated, or until the last argument is evaluated. Note that (AND) returns T.

4.5 ANDP

The call (ANDP X) returns the last element of X if all the elements of X are
non-NIL, otherwise it returns NIL. If X is the empty list NIL, ANDP returns T.

4.6 APPEND

The call (APPEND X[l] X[2] ••• X(n]) returns a list containing the elements of
the lists XCi]. For example, (APPEND @(A B C) @(D E) @«F» @(G» returns (A B
C D E (F) G). Note: Xen] is an EQ-tail of the resul t of APPEND.

4.7 APPLY

The call (APPLY FN AR:;S) calls the function FN with the elements of the list
ARGS as arguments and returns the result of FN. Example: (APPLY @ADD @(1 1»
returns 2.

4.8 ASCII

The call (ASCII N) creates a single character identifier whose ASCII print name
equals N. Note: The identifier is not INTERNed on the OBLIST. Example: (ASCII
101) returns an identifier with print name 'A'.

4.9 ASSOC

The call (ASSOC X L FN) searches the list of dotted pairs L for a pair whose CAR
is EO to X. If such a pair is found, it is returned as the value of ASSOC.
Otherwise, the value of FN, a function of no arguments, is returned. If FN is
anitted or NIL, ASSOC s~ly returns NIL if a dotted pair is not found.
SUMMARY OF PERMANENT SYMBOLS 4-3

4.10 A'IOM
The call (ATOM X) is T if X is not a list, i.e., if X is either an identifier or
a number. Otherwise the value of A'IOM is NIL.

4.11 BASE
The variable BASE controls the output radix for integers, and is initially set
to 8. If BASE = 10, then integers will print with a trailing ".", unless the
variable *NOPOINT = T. If BASE > 10, digits higher than 9 will appear as the
letters A - Z.

4.12 BIcr'

The call (BRT) displays a backtrace of all expressions suspended either by an


error or in order to evaluate llribedded subexpressions. BKT is used prlinarily to
determine the context of an error. BIcr' returns NIL.

4.13 CAR
The call (CAR X) returns the left half of the dotted pair X. If X is a list,
this amounts to returning the first element of X. The CAR of an atan is illegal
wi th one exception: The CAR of NIL is NIL.

4.14 CDR
The call (CDR X) returns the right half of the dotted pair X. If X is a list,
this amounts to returning the list X with its first element removed.
The CDR of an identifier returns the property list of that identifier.

4.15 CAAR, CADR, ••• , CDDDDR


All of the composite CAR-CDR functions with up to four A's and D's are
available.
Examples: (CADR X) = (CAR (CDR X»
(CAADDR X) = (CAR (CAR (CDR (CDR X) ) »
SUMMARY OF PERMANENT SYMBOLS 4-4

4.16 CHRCr

The call (CHOCT) returns the number of character positions remaining on the
output line of the selected output channel. When characters are output, if
CHRCT is made negative, a (TERPRI) is executed.

4.17 CHRVAL

The call (CHRVAL X) returns the ASCII representation of the first character of
the print name of X. If X is numeric, an ASCII 'i' is returned. If X is a
list, an ASCII '(I is returned.

4.18 CLRBFI
The call (CLRBFI) clears the terminal input buffer.

4.19 COND

A conditional expression has the following form:


{CONn (e[l,l] e[l,2] e[l,n[l]])
(e[2,1] e[2,2] e[2,n[2]])

(e[m,l] e[m,2] e [m,n [m] ]) )

where the e[i,j]'s are any S-expression.

The e[i,l]' s are considered to be predicates, i.e., evaluate to a truth value.


The e[i,l]'s are evaluated starting with e[l,l], e[2,1], etc., until the first
e[k,l] is found whose value is not NIL. Then the corresponding e[k,2] e[k,3]
.•• e[k,n[k]] are evaluated respectively and the value of e[k,n[k]] is returned
as the value of CONDo It is permissable for n[k] = 1, in which case the value
of e[k,l] is the value of CONDo If all the e[i,l] evaluate to NIL, then NIL is
the value of CX>ND.

4.20 CONS

The call (CONS X Y) creates a dotted pair with left half X and right half Y. If
Y is a list, this amounts to returning the list Y with X inserted as the first
element. **NOI'E** A special restriction of AlphaLisp is that Y may not be
numeric!
SUMMARY OF PERMANENT SYMBOts 4-5
4.21 CONSP
The call (<X>NSP X) returns X if X is not an atom, NIL otherwise.

4.22 COPY

The call (<X>PY X) returns a copy of X. All non-atomic-portions of X are


duplicated in storage. COpy is equivalent to (SUBST NIL NIL X) •

4.23 DE

The call (DE "10" "AroS" "BODY") places the form (LAMBm ARGS OODY) on the
property list of 10 under property EXPR. If 10 previously had any of the
properties EXPR., FEXPR, SUBR, FSUBR, or MACRO, then DE will return the list (10
REDEFINED). Otherwise DE returns ID.

4.24 DEFPROP

The call (DEFPROP "I" "V" "P") enters the property name P with property value V
into the property list of the identifier 1. If the property name P is already
in the property list, the old value is replaced by the new one; otherwise the
new property name P and its value V are placed on the beginnirl3' of the property
list. DEFPROP returns I.

4.25 OF
Same as DE except defines a function with FExpR property.

4.26 DIV

The call (DIV X Y) returns X/Y.

4.27 OM

Same as DE except defines a MACRO.


SUMMARY OF PERMANENT SYMOOLS 4-6

4.28 DREMOVE
The call (DREMOVE X L) is similar to the call (REMOVE X L), but DREMOVE uses EX:}
instead of EQUAL, am actually modifies the list L when removing X, and thus
does not use any additional storage. More efficient than REMOVE.
**NOlE** If L = (X ••• X) (Le., a list of any length all of whose top level
elements are EX:} to L) then the value returned by (DREMOVE X L) is NIL, but even
after then destructive changes to X there is still one CONS cell left in the
modified list which cannot be deleted. Thus if X is a variable and it is
possible that the result of (DREMOVE X L) might be NIL the user must set the
value of the variable given to DREMOVE to the value returned by the function.

4.29 DREVERSE
The value of (DREVERSE L A) is EQUAL to (REVERSE L A), but DREVERSE destroys the
original list L, and thus does not use any additional storage. More efficient
than REVERSE.

4.30 DRM [EXTENDED LIBRARY]

The call (DRM "CHARACTER" "FUNCTION") defines CHARACTER as a Normal Read Macro
with "FUNCTION" bein;J a function name or LAMBDA expression of no arguments which
will be evaluated each time CHARACTER is detected as a macro during input.
FUNCTION is put on the property list of CHARACTER under the property READMACID.
The value of DRM is CHARACTER.

4.31 [SKIN

The call (DSKIN FILESPEC) opens the file specified by FILESPEC for input on
channel T, and then READ-EVALs the contents of the file. This is the function
to use to read files created by [sKOUT. The value of [SKIN is NIL.

4. 32 [sKOUT [EXTENDED LIBRARY]

The call (DSKOUT "FILESPEC" "EXPRSLIST") as used to create an entire output file
specified by "FILESPEC". It evaluates all of the expressions in "EXPRSLIST".
If an expression in "EXPRSLIST" is atomic, then that atom is given to GRINL
instead of bein;J evaluated directly.

For example, if ENLIST is a list of your functions, they can be saved on a disk
file FUNCS.LSP by:
SUMMARY OF PERMANENT SYMBOLS 4-7

(Il3KOur "FUNes" FNLIsr)

4. 33 Il3M [EXTENDED LIBRARY]

DSM is exactly like DRM except that CHARACTER is defined as a Splice Macro.

4.34 DSUBST
The call (DSUBST X Y Z) is similar to the call (SOBST X Y Z), except DSUBST uses
EQ and not copy Z, but changes the list structure z itself. DSUBST substitutes
with a COpy of X. More efficient than SUBST.

4.35 EO
The value of (EQ X Y) is T if X and Yare the same pointer, i.e., the same
internal address. Identifiers on the OBLIST have unique addresses and therefore
EO will be T if X and Yare the same identifier. EO will also return T for
equivalent small integers, since they are represented as addresses. However, EO
will not canpare equivalent floating point numbers. For non-atanic
S-expressions, EO is T if X and Yare the same pointer.

4.36 ECUAL

The value of (ECUAL X Y) is T if X and Yare equivalent S-expressions, NIL


otherwise.

4.37 ERR

The call (ERR E) returns the value of E to the most recent ERRSET, or to the
LISP Supervisor if there is no ERRSET. If the value of E is ERRORX, then ERR
will return to the most recent ERRSET of the form (ERRSET - - ERRORX) •
Ordinarily, this will be the most recent top level supervisor call.
SUMMARY OF PERMANENT SYMBOIS 4-8

4.38 ERROR
The call (ERroR E) generates a real LISP error. E is evaluated, and if it is
non-NIL, it is PRINCed (unless error messages are suppressed) and then a break
occurs on the expression which invoked the error call.

4.39 ERRORX
Special argument to ERR.

4.40 ERRSET
The call (ERRSET E "F") evaluates the S-expression E and if no error occurs
durin;J its evaluation, ERRSET returns (LIST E). If an error occurs and F = NIL,
the error message is suppressed and ERRSET returns NIL, instead of a break
occurin;J. If the function ERR is called durin;J evaluation, then no message is
printed and ERRSET returns the value returned by ERR. If F is anitted, it is
assumed to be T.

4.41 EVAL
The call (EVAL E) evaluates the value of the S-expression E.

4.42 EXIT
The call (EXIT) causes termination of LISP and a return to the AMOS Monitor.

4.43 EXPLODE [EXTENDED LIBRARY]


The call (EXPLODE L) transforms an S-expression L into a list of single
character identifiers identical to the sequence of characters which would be
produced by PRIN1.
SUMMARY OF PERMANENT SYMBOLS 4-9
4.44 EXPWDEC [EXTENDED LIBRARY]
The call (EXPWDEC L) transforms an S-expression L into a list of single
character identifiers identical to the sequence of characters which would be
produced by PRINe.

4.45 EXPR
An EXPR is an identifier which has a LAMB~ expression on its property list with
property name EXPR. EXPRs are evaluated by binding the values of the actual
arguments to their corresponding dUll1lly variables. If there are more actual
arguments than dummy variables, the excess arguments are evaluated but ignored.
If there are more dUll1lly variables than actual arguments, ~~e excess dUll1lly
variables are bound to NIL.

4.46 FEXPR
An FEXPR is an identifier which has a LAMBDh expression on its property list
with property name FEXPR. FEXPRs are evaluated by binding the actual argument
list to the first dUll1lly variable without evaluating any arguments. Any
remaining dummy variables are bound to NIL.

4.47 FIXP
The call (FIXP N) returns T if N is a small integer, i.e., in the range -2"13
thru 2"13. Otherwise, FIXP returns NIL.

4.48 FLATLE
The call (FLATLE X N) returns (FLATSIZE X) if (FLATSIZE X) <= N. Otherwise,
FLATLE returns NIL.

4.49 FIATSIZE
The call (FLATSIZE X) is equivalent to (LENGTH (EXPWDE X».
SUMMARY OF PERMANENT SYMBOLS 4-10
4.50 FLATSIZEC
The call (FLATSIZEC X) is equivalent to (LENGTH (EXPLODEC X».

4.51 FLOATP
The call (FIDATP N) returns T if N is a floating point number, NIL otherwise.

4.52 FSUBR
A FSUBR is an identifier which has a dispatch number on its property list with
property name FSUBR. FSUBRs are evaluated by passing the unevaluated actual
argument list to the internal subroutine.

4.53 FUNCTION
The call (FUNCTION X) is currently equivalent to (QUOTE X) in AlphaLisp. It is
used to prevent the evaluation of a functional argument. In sane
nnp1ementations of LISP, FUNCTION invokes a special mechanism to maintain the
proper bindings of free variables in the functional argument.

4.54 GET
The call (GET I P) searches the property list of the identifier I looking for
the property name P. If such a property name is found, the value associated
with it is returned as the value of GET, otherwise NIL is returned. Note that
confusion exists if the property is found but its value is NIL.

4.55 GETL
The call (GETL I L) ~arches the property list of the identifier I looking for
the first property which is EQ to L or a member (MEMQ) of L. GETL returns the
remaining property list, including the property name if any such property was
found, NIL otherwise.
SUMMARY OF PERMANENT SYMBOLS 4-11
4.56 00
The call, (GO "10") causes the sequence of control within a PROG to be
transferred to the next statement following the label 10. If 10 is non-atanic,
it is repeated evaluated tmtilan atomic value is found. GO cannot transfer
into or out of a PROG.

4.57 GREAT
The call (GREAT X Y) returns T if X > Y, NIL otherwise.

4.58 GRINDEF [EXTENDED LIBRARY]

The call (GRINDEF "FI" "F2" ••• "Fn") is used to print the definitions of
functions and the values of variables in a format suitable for reading back in
to LISP, in what is known as DEFPROP-SErQ format. GRINDEF uses SPRINT to print
these S-expressions in a highly readable format, in which the levels of list
structure (or parenthesies levels) are indicated by indentation. GRINDEF prints
all the properties of the identifiers FI F2 ••• Fn which appear on the list
GRINPROPS. If Fi is non-atanic, it will be SPRINTed.

4.59 GRINL [EXTENDED LIBRARY]


The call (GRINL "FI" "F2" ••• "Fn") causes all of the atans, "FI" "F2" ••• "Fn",
and all of the atans on the lists which are the values of the atans Fl F2 ••• Fn
to be GRINDEFed. GRINL correctly prints out read macros and is the only
function which does. If any of the Fi are non-atomic, they are evaluated but
ignored.

4.60 GRINPROPS [EXTENDED LIBRARY]

The variable GRINPROPS contains the properties which will be printed by GRINDEF.
This variable can be set by the user to print special properties which he has
placed on atans. The initial value of GRINPROPS is (NIL EXPR FEXPR MACRO SUBR
FSUBR) •
SUMMARY OF PERMANENT SYMBOLS 4-12

4.61 IASCII

The call (!ASCII X) is equivalent to (INI'ERN (ASCII X»

4.62 IBASE
The variable !BASE specifies the input radix for integers which are not followed
by "." Integers followed by "." are decimal integers. IBASE is initially 8.

4.63 INC
The call (INC CHANNEL ACTION) selects the specified channel for input. The
channel NIL selects the tenninal. If ACTICN = NIL, the previously selected
input channel is not closed, but only deselected. If ACTION = T, that channel
is closed, making it available. INC evaluates its arguments and returns the
name of the previously selected channel.

4.64 INITPROMPT

Whenever LISP is forced back to the supervisor, the prompt character is reset.
The call (INITPOOMPT CHAR) is similar to the call (PROMPI' N) except that it sets
the supervisor prompt character instead of the current prompt character. The
call (INITPROMPT NIL) returns the ASCII value of the supervisor prompt character
without changing it.

4.65 INPUT

The call (INPUT "CHANNEL" IFlLESPEC") closes any file previously initialized on
the input channel, and initialized the file or device specified by FILESPEC for
input. INPUT does not evaluate its arguments and returns CHANNEL.

If the file specified by FILESPEC is not fourrl, an attempt is made to find the
file on DSKO:[7,4] with extension .LSP with the same file name.

4.66 INTEGER

The call (INTEGER N) returns the greatest integer less than N.


SUMMARY OF PERMANENI' SYMBOLS 4-13
4.67 INTERN

The call (INTERN I) puts the identifier I in the appropriate bucket of OBLIST.
If the identifier is alrecrly in the OBLIST, then INTERN returns a pointer to the
identifier already there. Otherwise, INTERN returns I.

4.68 LABEL

The form (LABEL "ID" "LAMBM-EXPR") defines a function with the temporary name
"ID". This makes it possible to construct recursive function expressions.

4.69 IMBm

The form (LAMBm "ARGUMENT-LIST" "BODY") defines a function by specifying an


ARGUMENT-LIST, which is a list of identifiers which are to serve as dummy
variables, and a body, which is one or more S-expressions. LAMBm expressions
are evaluated by "binding" actual arguments to the dummy variables, then
evaluating BODY with the current dunmy variable bindings. If BODY is a single
expression, it is sXmply eValuated. If BODY is several S-expressions, it is
interpreted as a PROGram (See PROG).

4.70 LAST

The call (LAST L) returns a list containing the last element of L.

4.71 LeONC

The call (LeONe PI'R L) is similar to the call (TCONC PI'R X) except that wheras
TCONC is used to add elements at the end of a list, LeONC is used for building
lists by adding lists at the end. Note that LeONe uses the same pointer
conventions as TCONC for elXminating searching to the end of a list, so that the
same pointer can be given to TCONC and LeONC interchangeably.

4. 72 LDIFF [EXTENDED LIBRARY]

In the call (LDIFF X Y), Y must be a tail of X, i.e., EXJ to the result of
applying sane number of CDRs to X. LDIFF gives a list of all elements in X but
not in Y, i.e., the List DIFFerence of X and Y. Thus (LDIFF X (MEMB FOO Y»
gives all elements in X up to the first FOO.
SUMMARY OF PERMANENT SYMBOlS 4-14
Note that the value of LDIFF is always a new list structure unless Y = NIL, in
which case (LDIFF X NIL) is X itself.
If Y is not a tail of X, LDIFF generates an error.

4.73 LENGTH
The call (LENGTH L) returns the number of top-level elements of the list L.

4.74 LESS
The call (LESS X Y) returns T if X < Y, NIL otherwise.

4. 75 LEXORDER
The value of (LEXORDER X Y) is T if X is lexically less than or equal to Y.
Note: Both arguments must be atans, and numeric arguments are lexically less
than symbolic arguments. If both X and Yare numeric, LEXORDER returns NIL.

4.76 LINELENGTH
The call (LINELENGTH N) is used to examine or change the maximum output
linelength. If N = NIL, the current line length is returned unchanged,
otherwise the line length is changed to the value of N, which is returned as the
value of LINELENGTH.

4.77 LINEREAD
The call (LINEREAD) reads a line, returning it as a list. If the last
expression read does not end at the end of the line or is incanplete, LINEREAD
continues reading.

4.78 LIST
The call (LIST X[l] X[2] ••• X[n]) evaluates the X[i] and returns a list of
their values.
SUMMARY OF PERMANENT SYMBOLS 4-15
4.79 LITA'KM
The call (LITATOM A) returns T if A is an identifier, i.e., a non-numeric atom.

4.80 LSUBST
The call (LSUBST X Y Z) is s~ilar to the call (SUBST X Y Z) except that X is
substituted as a segment. Note that if X is NIL, LSUBST returns a copy of Z
with all yls deleted.

4.81 MACro
A MACro is an identifier which has a LAMB~ expression on its property list with
property name MACro. MACros are evaluated by bindiIl3 the list containiIl:3 the
macro name and the actual argument list to the first dummy variable. My
remainiIl:3 dummy variables are bound to NIL. The body in the LAMBDA expression
is evaluated and should resul t in another, "expanded" form, which is then
evaluated.

4 • 82 MAKNAM
The call (MAKNAM L) transforms a list of single character identifiers (actually
takes the first character of each identifier) and ASCII character codes into an
S-expression identical to that which would be produced by READing those
characters. MAKNAM however does not INTERN any of the identifiers in the
S-expression it produces.

4.83 MAP
The call (MAP EN X[1] X[2] ••• X[n]) applies the function EN to the argument
list X[l] X[2] ••• X[n] arrl to successive CORls of all the X[i] until one of the
X[i] is reduced to an atcm or NIL. Note that if any of the X[i] except X[l] are
NIL, a circular list of NILls is substituted for those X[i]. The max~um value
of n is 4. The value of MAP is NIL.
SUMMARY OF PERMANENT SYMBOIS 4-16

4.84 MAPC
The call (MAPC FN X{l] X[2] ••• X[n]) applies the function FN to successive
elements fran the X[i] until one of the X[i] become exhausted, i.e., become
atomic or NIL. If any of the Xli] except X[l] are NIL, a circular list of NIL's
is substituted for those X[i]. The maximum value of n is 4. The value of MAPC
is NIL.

4.85 MAPCAN

MAPCAN is similar to MAPC except that it returns all the lists produced by FN,
NCONCed together.

4.86 MAPCAR

MAPCAR is similar to MAPC except that it returns a list of the results produced
by FN.

4.87 MAPCON

MAPCON is similar to MAP except that it returns all the lists produced by FN,
NCONCed together.

4.88 MAPLIST

MAPLIST is similar to MAP except that it returns a list of the results produced
by FN.

4.89 MEMB

The call (MEMB X L) is NIL if X is not EQ to any of the top level elements of L.
Otherwise, MEMB returns the tail of L starting at the position where X is found.
SUMMARY OF PERMANENT SYMOOIS 4-17

4.90 MEMBER
The call (MEMBER X L) is sDnilar to MEMB except that it uses EQUAL instead of
EQ.

4.91 MEMO
MEMO is just another name of MEMB.

4.92 MINUS
The call (MINUS X) returns -X.

4.93 MINUSP
The call (MINUSP X) returns T if X < 0, NIL otherwise.

4.94 MUL
The call (MOL X Y) returns X*Y, i.e., it multiplies together X and Y.

4.95 NCONC

The call (NCONC X Y) is sDnilar in effect to (APPEND X Y) but NCONC does not
copy list structures. NCONC modifies list structures by replacing the last
element of X with a pointer to Y. The value of N:ONC is the modified list X,
which is the concatenation of X and Y.

4.96 NCONS
The call (NCONS X) is equivalent to (ooNS X NIL) •
SUMMARY OF PERMANENT SYMBOLS 4-18

4.97 NEQ
The call (NEQ X Y) is equivalent to (Nor (EQ X Y»

4.98 NIL

The call (NIL X[l] X[2] ••• X[n]) returns NIL without evaluating the X[i]. In
general, NIL denotes falsehood, and is equivalent to the empty list" ()". NIL
is unique in that it is both an atom and a list.

4.99 Nor
The call (NOT X) returns T if X is NIL, and NIL if X is non-NIL (e.g., T).

4.100 N'IH
The call (NTH X N) returns the tail of X beginning with the Nth element, e.g.,
if N = 2, the value is (CDR X). If N = 0, for consistency, the value is (CONS
NIL X).

4.101 NTHCHAR
The call (NTHCHAR X N) returns the Nth character in the EXPLODEC representation
of X. If N is negative, (NTHCHAR X N) returns the Nth fran last character of
the EXPLODEC representation of X.

4.102 NULL
The call (NULL X) returns T if X is NIL, NIL otherwise.

4.103 NUMBERP
The call (NUMBERP X) returns T if X is numeric, NIL otherwise.
SUMMARY OF PERMANENT SYMBOLS 4-19
4.104 OBLISl'
In order that occurrences of identifiers with the same print names have the same
internal address (an:'! hence value), a special list which is the value of the
variable OBLIST is used to remember all identifiers which READ and some other
functions have seen. For the sake of searching efficiency, this list has two
levels; the first level contains 16 sequentially stored "buckets" which are
"hashed" into as a function of the print name of the identifier. Each bucket is
a list of all distinct identifiers which have hashed into that bucket. Thus,
(CAR OBLISl') is the first bucket, and (CAAR OBLISl') is the first identifier of
the first bucket.

4.105 ONEP
The call (ONEP X) returns T if X = 1, NIL otherwise.

4.106 OR

The call (OR X[l] X[2] ••• X[n]) returns the value of the first non-NIL X[i], or
NIL if the value of all the X[i] 's is NIL. OR evaluates its argtnnents fran left
to right until a non-NIL argtnnent is found, leaving the remaining argtnnents
unevaluated. Note that (OR) returns NIL.

4.107 ORP
The call (ORP X) returns the first non-NIL element of X or NIL.

4.108 OUTC
The call (OUTC CHANNEL ACTION) selects the specified channel for output. The
channel NIL selects the terminal. If ACTICN = NIL, then the previously selected
output channel is not closed, but only deselected. If ACTION = T, then any
buffered output is sent to the previous file, and the file is closed. OUTC
evaluates its argtnnents and returns the name of the previously selected channel.
SUMMARY OF PERMANENT SYMBOLS 4-20

4.109 OUTPur
The call (OUTPUT "CHANNEL" "FILESPEC") closes any file previously initialized on
the output channel, and initializes the file or device specified by FILESPEC for
output. OUTPUT does not evaluate its arglll\ents and returns CHANNEL. If a file
specified by FILESPEC already exists, it is deleted before the new file is
ini tial ized •

4.110 PLUS [EXTENDED LIBRARY]


The call (PLUS X[l] X[2] ••• X[n]) returns the sum of all the XCi] 'so

4.111 PRINI
The call (PRINl S) causes the S-expression S to be printed on the selected
output device with no preceedin;; or fo11owin;; spaces. PRINl also inserts
slashes ("/") before any characters which would otherwise be syntactically
incorrect. Double quotes around strin;;s and repeated double quotes within
strings are also printed. 'lWO element lists beginning with QUOTE are printed in
, @, format (see QUarE) •

4.112 PRINe

PRINC is the same as PRINl except that no slashes are inserted, double quotes
are strin;;s and repeated double quotes within strin;;s are suppressed, and QUOTE
appears normally.

4.ll3 PRINT
The call (PRINT S) is equivalent to (PRCX.72 (TERPRI) (PRINI S) (PRINC @/ ».

4 .114 PROCEED
The call (PROCEED N) RESUMEs evaluation of the currently pending expression and
causes an interrupt after N expressions are subsequently entered for evaluation.
SUMMARY OF PERMANENT SYMBOLS 4-21

4.115 PROO
The call (PRCX; "VARLIST" "BODY") specifies a list of program variables, VARLIST,
which are initialized to NIL when the PROG is entered, and a body which is a
list of labels (which are identifiers) and statements which are non-atomic
S-expressions. PROG evaluates its statements in sequence lIDtil either a RETURN
or GO is evaluated, or the list of statements is exhausted in which case the
value of PROG is NIL.

4.116 PROGI
The call (PRCX;l X[l] X[2] ••• X[n]) evaluates all the expressions X[l] X[2] •••
X[n] (n<6) and returns X[l] as its value.

4.117 PRCX;2
The call (PRCX;2 X[l] X[2] ••• X[n]) evaluates all the expressions X[l] X[2] •••
X[n] (n<6) and returns X[2] as its value.

4.118 PROGN
The call (PRa;N X[l] X[2] ••• X[n]) evaluates all the XCi] and returns X[n].

4.119 PROMPI'
The call (PROMPT N) resets the prompt character displayed by the input routines
when a new line is requested, to the character whose ASCII representation is N.
If N is NIL, the prompt is left unchanged. The value of PROMPI' is the previous
value of the prompt character.

4.120 PUTPOOP
The call (PUTPROP I V P) enters the property name P with property value V into
the property list of identifier 1. If the property name P is already in the
property list, the old value is replaced by the new one; otherwise, the new
property name P am. its value V are placed on the beginnirg of the property
list. PUTPROP returns V.
SUMMARY OF PERMANENT SYMBOrs 4-22
4.121 QUOTE
The call (QUOTE "E") returns the S-expression E without evaluating it. To
~prove the clarity of expressions and programs, there exists a concise notation
for (QUOTE "E"): @"E". This alternate notation is accepted by the read routines
and displayed by all print routines except PRINC.

4.122 COOTIENT [EXTENDED LIBRARY]


The call (QUOTIENT X[l] X[2] ••• X[n]) returns X[1]/X[2]/ ••• /X[n].

4.123 RDNAM
The call (RDNAM) is s~ilar to the call (READ) except that identifiers are not
INTERNed.

4.124 READ
The call (READ) causes the next S-expression to be read from the selected input
device, and returns the internal representation of the S-expression. READ uses
INTERN to guarantee the references to the same identifier are EQ.

4.125 READCH
The call (READCH) causes the next character to be read from the selected input
device and returns the corresponding single character identifier. READCH uses
INTERN.

4.126 READLIST
The call (READLIST L) is identical to (MAKNAM L) except that READLIST INTERNs
all identifiers in the S-expression it produces. READLIST is the logical
inverse of EXPLODE.
SUMMARY OF PERMANENT SYMBOIS 4-23

4.127 READMACro

A READMACRO is a single character identifier which has a LAMB~ expression on


its property list with property name READMACRO. In order for READ to recognize
a character as a READMACRO, the character's internal description must be changed
with SETCHR. DRM and DSM are normally used to define READMACROs.

4.128 RECIP

The call (RECIP X) returns l/X.

4.129 REMAINDER
The call (REMAINDER X Y) returns the remainder of X divided by Y. X and Y must
be small positive integers.

4.130 REMOB [EXTENDED LIBRARY]

The call (REMOB "1[1]" "1[2]" "I[n] ") removes the identifiers I[i] from the
OBLIST and returns NIL.

4.131 REMOVE

The call (REMOVE X L) removes all top level occurrences of X from the list L,
giving a COPY of L with all top level elements EQUAL to X removed.

4.132 REMPROP

The call (REMPROP I P) removes the property P from the property list of
identifier 1. REMPROP returns T if there was such a property, NIL otherwise.

4.133 RESET

The call (RESET) clears the suspended evaluation stack and returns control to
the top level supervisor.
SUMMARY OF PERMANENT SYMBOLS 4-24

4.134 RESUME
The call (RESUME) resumes evaluation of a suspended expression.

The call (RESUME "E") substitutes E for the suspended expression and resumes
execution. If possible, the expression containing the suspended expression is
physically modified to substitute E for the suspended expression using DSUBST.

4.135 RE'IURN

The call (RETURN V) causes the most recent PROG to be exited with the value V.

4.136 REVERSE

The call (REVERSE L) returns the reverse of the top level elements of the list
L.
The call (REVERSE L A) returns (NOONC (REVERSE L) A).

4.137 RPLACA

The call (RPLACA X Y) replaces the CAR of X by Y. 'lhe value of RPLACA is the
modified S-expression X.

4.138 RPLACD
The call (RPLACD X Y) replaces the CDR of X by Y. The value of RPLACD is the
modified S-expression X.

4.139 SELEcm

The call (SELECTQ X "Yl" "Y2" ••• "Yn" Z) is used to select a sequence of
instructions based on the value of X (this call is often refered to as a CASE
statement in other languages). Each of the Yi is a list of the form (Si E[l,i]
E [2, i] ••• E [k, i]) where Si is the "selection key".

If Si is an atom the value of X is tested to see if it is EQ to Si (not


evaluated). If so, the expressions E [1, i] ••• E [k, i] are evaluated in sequence,
and the value of SELECTQ is the value of the last expression evaluated, i.e.
E[k,i].
SUMMARY OF FERMANEN!' SYMBOLS 4-25

If Si is a list, arrl if any element (not evaluated) of Si is EQ to the value of


X, then E[l,i] ••• E[k,i] are evaluated in turn as above.
If Yi is not selected in one of the two ways described then Y[i+l] is tested,
etc. until all the Y's have been tested. If none is selected, the value of
SELECl'Q is the value of Z. Z must be present.

4.140 SET

The call (SET E V) changes the value of the identifier specified by the
expression E to V am returns V. Both arguments are evaluated.

4.141 SETCHR

The call (SETCHR CHAR BITS) allows the internal description for the ASCII
character CHAR to be modified to the value specified by BITS. BITS must be the
sum of some canbination of the following flags:

200 Don't slashify character as first character


of an identifier.

4 Splice option of READMACID.

1 READMACID.

4.142 SETQ

The call (SETQ "ID" V) changes the value of ID to V and returns V. SETQ
evaluates V, but does not evaluate ID.

4.143 SPRINT

The call (SPRINT EXPR IND :RMAR3IN) "pretty prints" EXPR in a human readable
form, with the levels of list structures shown by indentation alorg the line.
The initial indentation is IND - 1 spaces. ~IN is the anount of space to
reserve in the right margin for the last line printed in order to print any
enclosing tail, and is normally anitted. If IND is an it ted , it defaults to one.
SUMMARY OF PERMANEN!' SYMBOIS 4-26
4.144 STRINGP
The call (STRINGP X) returns T if X is a str ing, NIL otherwise.

4.145 SUB
The call (SUB X Y) returns X-Yo

4.146 SUBI
The call (SUBI X) returns X-I.

4.147 SUBR
A SUBR is an identifier which has a dispatch number on its property list with
property name SUBR. SUBRs are evaluated by evaluating up to five actual
arguments and passing the results to the internal subroutine. Any additional
arguments are ignored, and hence left unevaluated.

4.148 SUBST
The call (SUBST X Y S) substitutes S-expression X for all EQUAL occurrences of
S-expression Y in S-expression S.

4.149 T
The call (T X[l] X[2] ••• X[n]) is equivalent to (PRDGI X[l] X[2) ••• X[n). In
general, T denotes truth or success.

4.150 TAB
The call (TAB N) tabs to position N on the output line doing a TERPRI first if
the current position is already past N. Note should be taken that TAB outputs
spaces only when necessary and outputs tab characters otherwise.
SUMMARY OF PERMANENT SYMBOLS 4-27

4.151 TAILP

The call (TAILP X Y) returns X if X is a list and a tail of Y (i.e., X is EQ to


some number of CDR'S of Y), NIL otherwise.

4.152 '.OCONC

The call (TOONC PTR X) is useful for building a list by adding elements one at a
time at the end. This could be done with NCONC. However, unlike NCONC, ':OCONe
does not have to search to the end of the list each time it is called. It does
this by keepin; a pointer to the end of the list bein; assembled, and updatin;
this pointer after each call. The savings can be considerable for long lists.
The cost is the extra cell required for storin; both the list being assembled,
and the end of the list. PTR is that cell: (CAR Pl'R) is the list being
assembled, (CDR Pm) is (LAST (CAR Pm». The value of ':OCONC is Pl'R, with the
appropriate modifications to its CAR and CDR. Note that '.OCONC is a destructive
operation, usin; RPLACA and RPLACD.

':OCONe can be initialized in two ways. If Pl'R is NIL, ':OCONe will make up a
pointer. In this case, the program must set some variable to the value of the
first call to '.OCONC. After that it is unnecessary to reset since ':OCONC
physically chan;es Pl'R.

If Pl'R is initially (NIL), the value of '.OCONC is the same as Eor Pl'R = NIL, but
':OCONC changes Pl'R. This method allows the program to initialize, and then call
':OCONC without having to perform SETQ on its value.

4.153 TERPRI

The call (TERPRI X) prints a carriage-return and line-feed and returns the value
of X. X may be omitted if the value of TERPRI is not used.

4.154 TIMES [EXTENDED LIBRARY]

The call (TIMES X[l] X[2] ••• X[n]) returns the product of all the X[i] 'So

4.155 TI'YECHO

The call (TTYECHO) complements the terminal echo switch, returning T if echoing
is bein; turned on or NIL if it is bein; turned off.
SUMMARY OF PERMANENT SYMBOLS 4-28
4.156 TYI
The call (TYI) causes the next character to be read from the selected input
device and returns the ASCII code for that character.

4.157 TYO
The call (TYO N) prints the character whose ASCII value is N, and returns N.

4.158 UNBOUND
The call (UNBOUND) returns the un-INI'ERNed atom UNBOUND which the system binds
to an identifier to indicate that it currently has no assigned value.

4.159 UNTYI
The call (UNTYI CHAR) "unreads" a character (such as a character input by TYI or
READCH), so that the nex t call to READ, TYI, etc., will pick up the UNTYI I ed
character as the next character to be read, and returns the ASCII code for that
character. NOTE: In the LISP READ routine, an atom may be terminated either by
a break character (a character which must be interpreted by READ as well as
serving to terminate the atan, such as "(", ")", "[", "]", and ".") or a
separator character (a character used only to separate atoms, etc., but not in
itself meaningful, such as carriage-return or blank). In order to save a break
character for later interpretation, the LISP READ routines use a one-character
buffer. UNTYI simply stores its argument in this buffer: thus there are two
problems with using TYI. First, if UNTYI is used several times in succession
with no intervening READs, TYls, etc., then only the most recent character is
actually "unread" -- all others are lost. Second, if there is a break character
in the one-character buffer when an UNTYI is performed, the break character will
be lost.

4.160 VCONC
The call (VCONC Pl'R) is used in conj unction wi th TCONC or I.CONC to return the
list they have built. VCONC is currently equivalent to CAR. reference by Pl'R
back into the free cell list.
SUMMARY OF PERMANENT SYMBOIS 4-29

4.161 XCONS
The call (XCONS X Y) is equivalent to (CONS Y X)

4.162 ZEROP
The call (ZEROP X) returns T if X = 0, NIL otherwise.

4.163 #EXPIDDE
#EXPIDDE is similar to EXPIDDE except that it returns a list of ASCII character
codes.

4.164 #EXPLODEC
#EXPLODEC is similar to EXPLODEC except that it returns a list of ASCII
character codes.

4.165 #NTHCHAR
#NTHCHAR is similar to NTHCHAR except that the ASCII value of the character is
returned.

4.166 $EOF$
When an end-of-file is detected during input, (ERR $EOF$) is executed.

4.167 *EXPAND [EXTENDED LIBRARY]


The call (*EXPAND L FN) is used within macros to perform macro expansion.
*EXPAND is used by PLUS, TIMES, and QUQrIENI'.
Examples:
PLUS can be defined as follows:
(LM PLUS (L) (*EXPAND L @ADD»
(PLUS A B C) would be expanded as follows:
SUMMARY OF PERMANENT SYMOOLS 4-30
(*EXPAND @(PLUS A B e) @ADD) = (ADD A (PLUS B e))
(*EXPAND @(PLUS B e) @ADD) = (ADD B (PLUS e))
{*EXPAND @(PLUS e) @ADD) = e
Thus converting (PLUS A B e) into (ADD A (ADD Be)).

4.168 *NOPOINl'

I f BASE = 10, integers will print with a trailing


*NOPOINl' is set to T.
.
" " unless the variable
Bibliography

Berkeley, E.C., and D.G. Bobrow (eds). "The Progranming La.n:;Juage


LISP: Its Operation and Applications," The M. LT. Press,
Cambridge, Mass., 1962.

Friedman, D.P. "The Little LISPer," Science Research Associates,


Inc., Palo Alto, Calif., 1974.

Maurer, W.D. "A Prograrmner's Introduction to LISP," American


Elsevier Publishing Company, Inc., New York, 1973.

McCarthy, J. "Recursive Functions of Symbolic Expressions and


their Computation by Machine," Part I, Conm. ACM,3,4 (1960),
184-195.

McCarthy, J., P.W. Abrahams, D.J. Edwards, T.P. Hart, and M.I. Levin,
"LISP 1.5 Programner's Manual," The M.LT. Press, Cambridge,
Mass. 1962.

Quam, L.H. and W. Diffie, "Stanford Artificial Intelligence Laboratory


Operating Note 28.6, Stanford LISP 1.6 Manual," Stanford
University.

Ribbens, D. "Prograrmnation non numerique," LISP 1.5, Dunrod, Paris,


France, 1970.

Siklossy, L. "Let's Talk LISP," Prentice-Hall, Inc., Englewood Cliffs,


N.J., 1976.

Weissman, C. "LISP 1.5 Primer ," Dickenson Publishing Company, Inc.,


Encino, Calif., 1966.

You might also like