sailon 28.1 - Software Preservation Group

Transcription

sailon 28.1 - Software Preservation Group
June
STANFORD ARTIFICIAL INTELLIGENCE I~ABOFtATOraT
OPERATING NOTE NO, 28.1
13, 1968
by Lynn Qpa
and John Allen
ABSTRACT:
This note d e s c r i b e s t h e LISP 1.6 system t h a t r u n s on
t h e PDP-6 computer i n t h e Stanford A.I. Laboratory.
The d e s c r i p t i o n i s intended f o r r e a d e r s who a r e
g e n e r a l l y f a m i l i a r with t h e LISP 1,5,
ACKNOWLEDGEMENT: The PDP-6 LISP system was developed a t M.I.T.
and adapted f o r t h e S . t a r f r r d A.1. P r o j e c t by
John Allen. This i s a 14ev,sion of SAILON-28,which
was an a d a p t a t i o n of M,I.T. A . I . Memo No. i16.
"-j' i n t h e l e f t hand mLwgirLi.ndicates a new featqxce.
INTRODUCTION
This i s a mosaic d e s c r i p t i o n of P D P . - ~LISP, intended f o r r e a d e r s
f a m i l i a r w i t h t h e LISP 1.5 Programmerqs Manual o r who have used LISP
on some o t h e r computer, Many of t h e f e a t u r e s a r e s u b j e c t t o change.:
Thus, you should c o n s u l t a PDP-6 systems programmer f o r any d i f f e r e n c e s
which may e x i s t between LISP of June 1968 and p r 6 s e n t LISP on t h e
system t a p e ,
SOME DISTINCTIVE CHA3IACTERISTICS
Top-level i n p u t i s t o EVAL; t h e r e i s no EVALQUOTE,
Thus LISP's l i s t e n loop may be described by
(PROGNIL
A
I
(TERPRI
(PRINT (EVAL (READ)))
-(GOA ) )
One types ATOM followed by a space t o g e t t h e value of
) t o apply a
ATOM, o r (FN (QUOTEa r g l ) (QUOTE arg2).
f u n c t i o n t o e x p l q c i t arguments. For t h i s reason, u s e r s
f r e q u e n t l y *arrange t h e i r t o p - l e v e l f u n c t i o n s t o be FEXPRs
o r FSUBRs t o avoid t h e n e c e s s i t y of quoting e x p l i c i t &rguments
A l t e r n a t i v e l y , they may SET& atoms t o f r e q u e n t l y used o r unwieldy argument l i s t s , &nd apply t h e i r f u n c t i o n s
t o t h e s e atoms,
..
.
SAILON No. 2 8 . 1
(EQUALf ixed-point-number f l o a t ing-point-number ) i s NIL.
(EVALNIL) i s NIL.
(EvAL T ) i s T.
(ZEROP0.0) i s NIL.
*T* and F do n o t e x i s t .
Current bindings of i n t e r p r e t e d
There i s no a - l i s t .
v a r i a b l e s and f r e e compiled v a r i a b l e s a r e s t o r e d i n t h e
CDR of t h e v a r i a b l e ' s VALUE property, which i s a l s o t h e
v a r i a b l e 1s SPECIAL c e l l .
Their v a l u e s may be changed w i t h SET and SETQ; CSET and
CSETQ do not e x i s t . Higher-level bindings of t h e s e
v a r i a b l e s a r e s t o r e d on t h e s p e c i a l pushdown l i s t .
A l l i n t e r p r e t e d v a r i a b l e s and f r e e compiled v a r i a b l e s
a r e automatically SPECIAL and provide complete communication
between compiled and i n t e r p r e t e d f u n c t i o n s . COMMON does
not exist.
Flags axe n o t allowed; elements on a p r o p e r t y l i s t of an
atom a r e expected t o be p a i r e d ,
MAP, MAPCAR, e t c . assume t h e f i r s t argument i s t h e
function, and t h e seccnd i.s t h e l i s t of arguments t o
which it i s t o be applied.
There i s no DEFINE; d e f i n i n g of f u n c t i o n s i s u s u a l l y
done with DEFPROP,
The a v a i l a b l e input-output devices a r e t h e on-line
t e l e t y p e , t h e disk, t h e DECtapes, and MAGTAPE and t h e
l i n e p r i n t e r . For t h e i r use, see "input-output".
One may a l l c c a t e a s much a s one wishes ( w i t h i n l i m i t s )
of each type of LISP s t o r a g e each time LISP i s s t a r t e d .
See "Allocator" f o r how t o use t h i s f e a t u r e .
L,..A-a a r e t r e a t e d ic~aitThe c h a r a c t e r s s p a x ,
i c a l l y and a r e used t,o s e p a r a t e items on a l i s t , and t o
d i s t i n g u i s h d o t - n o t a t i o n p e r i o d s from p e r i o d s denoting
f l o a t i n g - p o i n t o r decimal numbers. A sequence of spaces,
commas, o r t a b s i s e q u i v a l e n t t o a s i n g l e one. Spaces
commas, o r t a b s a d j a c e n t t o parentheses have no e f f e c t .
-Ad
\
Object
I n d i c a t o r Relevant Information
ABS
SUBR
Absolute value.
ADD 1
SUBR
Result i s f i x e d o r f l o a t i n g , same a s
argument.
,
.
I
.
,
'
,
,
,
,
SAILON No. 28.1
Allocator
a/
b/
c/
d/
d/
Th.ere a r e f i v e s t o r a g e a r e a s i n LISP:
Free Storage: holds s-expressions
F u l l Word Space: holds c h a r a c t e r stjrings of
p r i n t names, f l o a t i n g p o i n t and l a r g e f i x e d p o i n t numbers ( s e e "~umbers").
Binary Program Space: holds compiled f u n c t i o n s
and a r r a y s .
Speci a 1 Pushdown L i s t : holds h i g h e r - l e v e l
bindings of a l l s p e c i a l v a r i a b l e s ,
Regu-l a r Pushdown L i s t : holds r e t u r n addresses
f o r s u b - r o u t i n e c a l l s , bindings of a l l l o c a l
v a r i a b l e s , and i s a l s o used by v a r i o u s
internal routines.
When L3S; . ,- ,. -<i: r, t h e A l l o c a t o r types o u t
ALLOC? and waits f o r t h e u s e r t o type Y ( y e s )
o r N (no). If Y is typed, t h e A l l o c a t o r responds
with FULL WORDS-- and w a i t s f o r t h e u s e r t o type an
o c t a l number (ending with a space). The A l l o c a t o r
then s i m l l a r a y r e q u e s t s typed-ln p a r m e t e r s f o r t h e
s i z e of B i n a s y Pragran Space, S p e c i a l Pushdown L i s t , _
and Fegul-ar Pushdown L i s t , Free Storage i s given
a l l remainlag space. For any t y p e d - i n number,
SPACE alone may be typed i n and a s t a n d a r d value
w i l l 5 e taken:
FULL ms
41616
BIN. PROG SP. 2@$$
SPEC. PDL
I@$@
REG, PDL
1@@@
.
I f N ( o r SPACE) i s typed a s t h e response t o ALLOC?
a l l s t a n d a r d values a r e taken. I n c a s e of e r r o r ,
RUBOUT w i l l type a n X and c a n c e l t h e c u r r e n t value.
See t h e appendix r'or r e a l l o c a t i o n of r e s t a r t e d LISP
f i l e s and a d e s c r i p t i o n of t h e LISP MACROX l o a d e r .
AND
FSUBR
Returns N I L o r l a s t non-NIL argiment:
does not evaluatx arguments p a s t f i r s t NIL.
APPEND
LSUBR
Appends t o g e t h e r w-y number of arguments,
copying t h e t o p l e v e l of a l l b u t t h e l a s t
of them.
(APPEND)i s NIL and (APPEND X )
is EQ tc X.
SAILON No. 28.1
APPLY
LSBR
-(APPLY f n ( a r g s ) ) o r (APPLY f n ( a r g s )
a l i s t ) . See EVAL f o r t h e formal of a l i s t .
ARM
FSUBR
(ARRAY name par dim1 dim2 .) s e t s up
name as an a r r a y ( a c t u a l l y a s a SUBR).
Par should be T f o r a r r a y s whose elements
a r e S-expressions, and w i l l ' cbnsequentu
be p r o t e c t e d from garbage c o l l e c t i o n .
Par should be NIL f o r a r r a y s whose
elements a r e f l o a t i n g p o i n t numbers
(FLONUMS).A par from 1 t o 36. s p e c i f i e s
t h e byte s i z e f o r a f l e x i b l e b y t e s i z e
array, whose elements a r e f i x e d p o i n t
1n.tegers (FMNUMS) Both STORE and
KSTl?:?4P ~ - \ ~ a l u atthee i r second argument
before t h e i r f i r s t , An a r r a y may have
no more than f i v e dimensions; i n d i c e s
Arrays a r e s t o r e d
run from @ t o dim-1.
i n binary program space, ARRAY r e t u r n s
t h e base address of t h e array.
..
-
.
ARG
SUBR
See LSUBR.
ASCII
SUBR
The f i x e d p o i n t argument i s converted
i n t o t h e corresponding s i n g l e - c h a r a c t e r
A S C I I atom,
ASSOC
SUBR
Uses EQ,
BAKGAG
SUBR
(BAKGAG
T ) enables a backtrace of any
LISP e r r o r except pushdown l i s t overflow;
(BAKGAG
NIL) d i s a b l e s it. A backtrace
i s p r i n t e d a s a s e r i e s of f u n c t i o n c a l l s
a s determined from t h e r e g u l a r pushdown
iist, most r e c e n t f i r s t :
fnl-fn2
fnl-EVALARGS
fnl-ENTER
a-fnl
BASE
VALUE
Binary frogram Space
f
a
f n l c a l l s fn2
arguments being evaluated p r e p a r a t o r y t o
calling f n l
f n l being evaluated
r e p q ~ . s e n t san i n t e r n a l
rout me,
Current r a d i x of f i x e d - p o i n t number
output; may be modified with SETQ.
Storage wza far compiled f u n c t i o n s and
r e g i s t e r s long.
a r r a y s ; u s u a l l y i s 2@@@
SAILON No. 28.1
BOOZE
LSUBR
..
(BOOLEn a b c
. ) causes a 3 6 - b i t
b i t w i s e Boolean o p e r a t i o n t o be performed
on a and
on t h e r e s u l t and 2, e t c . The
numcer 2 s e l e c t s t h e o p e r a t i o n a s follows:
o ~ e r aion
t
operation
BPEND
VALUE
Highest l o c a t i o n a v a i l a b l e f o r use a s
Binary Program Space.
BPORG
VALUE
Current lowest unused l o c a t i o n i n
Binary Program Space.
CAR
SUBR
Left h a l f .
- 1,
CDR
SUBR
Right h a l f . CDR of an atom i s i t s
property l i s t .
CAR of an atom i s t h e "pointer"
CAAR, CADR e t c . through CDDDDR
CHRCT
and A ' s .
Any combination of up t o
SUBR
The value of (CHRCT)i s t h e number of
c h a r a c t e r s remaining on t h e c u r r e n t out-
-,.-1-
COMPILER
4 D's
SUBRS
'"YP.
The compiler i s a s e p a r a t e dump f i l e
c a l l e d COMPLR r e q u i r i n g 24~. This core
image a l s o c o n t a i n s W. The compiler
w i l l compile LAP-able code onto t o t h e
s e l e c t e d output device. E r r o r messages
w i l l appear on t h e t e l e t y p e . A t t h e
conclusion of t h e compilation t h e l i s t
of f u n c t i o n s compiled i s p r i n t e d on t h e
teletype.
One can continue t o compile
onto t h e s e l e c t e d f i l e or do
"(oUTC NIL T ) " and c l o s e t h e f i l e . I n
any case a f t e r compiling t h e l a s t
functions, "(OUTCNIL T)" must be done t o
a s s u r e a proper end of f i l e . Now "1NC"O~-"IMPUT" t o t h e LAP-able f i l e w i l l
begin i n p u t a t t h e c u r r e n t value of BPORG.
I f one i s f i n i s h e d w i t h J t h e compiler
r e s e t t i n g BPORG t o t h e o r i g i n of t h e
compiler w i l l reclaim t h e Binary Program
Space. I f a "clean system" i s desired,
read i n LISP with a p p r o p r i a t e core and a l l o c a t e s u f f i c i e n t BPS with t h e a l l o c a t o r .
Read i n LAP and then i n p u t t h e compiled
code. To compile a l i s t of f u n c t i o n s
fl, f2
, f n execute (COMPILE fL. f 2 fn). To compile t h e c u r r e n t l y '
,.., . u 3 ,
input f i l e onto t h e s e l e c t e d
output f i l e , execute (coMPL). The i n p u t
f i l e should be terminated by t h e atom T.
The output f i l e w i l l c o n t a i n both t h e
LAP code and any sexpr on i n p u t f i l e
which i s n o t an EXPR, FEXPR o r MACRO.
.. .
...
COND
FSUBR
"COND p a i r s " of p r e d i c a t e and value may
have o t h e r than two elements. I f t h e
p r e d i c a t e e v a l u a t e s nor,-XI& t h e remaining
elements a r e evaluated i n CAR-to-CBR
order, and t h e value of t h e l a s t i s t h e
value of t h e COPaD. I f no p r e d i c a t e i s
t r u e , t h e value of t h e COND i s NIL.
CONS
SUBR
One of t h e f i v e elementary f u n c t i o n of
LISP.
Current Problems
Compiled GOs and RETURNS happen when
encountered; i n t e r p r e t e d GOs and Rl3TURNs
h q p e n when e v a l u a t i o n of t h e f u n c t i o n s
they a r e contained i n (except PROG) i s
completed. Arguments t o GO a r e r e p e a t e d l y
evaluated u n t i l atomic when i n t e r p r e t e d ,
b u t a r e evaluat-ed only once when compiled.
Compiled GOs and RETURNS must appear
e x p l i c i t l y i n t h e PROG t o which they apply,
GOs and RETURNS o c c a s i o n a l l y confuse t h e
compiler when appearing i n compositions of
f u n c t i o n s o t h e r than PROG, COND, AND, OR,
and NOT, Variables used f r e e i n a functiona l context must be declared SPECIAL o r e l s e
t h e compiler w i l l mistake them f o r undefined EXPRs o r SUBRs.
SAILON No. 28.1
-+
CSYM
FSUBR
The i n i t i a l i z i n g f u n c t i o n f o r GENSYM.
(CSYMSYM N) w i l l s e t t h e f i v e - c h a r a c t e r
name, SYM, a s t h e i n i t i a l l y generated
symbol f o r (GENSYM
N). I f CSYM i s not
used GOO01 i s assumed,
DEFPROP
FSUBR
(DEFPROPatom p r o p e r t y i n d i c a t o r ) ; value
i s atom,
DEPOSIT
SUBR
DDTIN
FSUBR
Causes t h e fixed-point number which i s
' i t s second argument t o be deposited i n
t h e a b s o l u t e machine l o c a t i o n which i s
i t s f i r s t argument,
(~%:r;l.") s e l e c t s DDT sl~hmodei n ~ u ton
keletype.
(DDTIN Nfi) s e l e c t s b u f f e r e d
l. i n e mode i n ~ u ton t e l e t"n e . (DDTIN)
r e t u r n s T o r NIL according t o t h e curr e n t l y s e l e c t e d i n p u t mode, I n DDT
submode c h a r a c t e r s a r e i n p u t one a t a
9
a
,
time a s opposed t o b u f f e r e d l i n e mode i n
which an e n t i r e l i i e v g of c h a r a c t e r s
terminated by a c a r r i a g e r e t u r n , l i n e feed, cr altmode) i s u n i t of i n p u t from
t h e t e l e t y p e , This d i f f e r e n c e i s most
n o t i c a b l e when running i n DDT submode
'under swapping conditions, which f o r c e
t h e e n t i r e program t o be swapped i n t o
core f o r each c h a r a c t e r . I n line-anode,
t h e program need be swapped i n t o core
only a t t h e end of a - l i n e of input.
Fcs. more information s e e REA.&*~+:..
A&:-v
-
a.
a.
.
P
I
I
-
FSUBR
(DDTOTJT T) s e l e c t s s i n g l e c h a r a c t e r
bcli.tYke
output ( s i m i l a r t o DDT submode
output) *
(DDTOUT NIL) s e l e c t s b u f f e r e d mode
t e l e t y p e output.
(DDTOUT)
r e t u r n s T o r NIL according
t o t h e c u r r e n t l y s e l e c t e d output mode.
4-
Usually, one should use (DDTOUTNIL)
f o r swapping e f f i c i e n c y , I n b u f f e r e d
output mode, output i s f o r c e d ( s e e FORCE)
whenever e i t h e r t h e b u f f e r i s f u l l , o r a
t e l e t y p e input i s requested,
SAILON No. 2 8 J
DIFFERENCE
LSUBR
argl
s g .
"
SUBR
-
arg2
2
.
-
3rg3
.. .
(DIFFERENCE)
The b a s i c r e a d f u n c t i o n of t h e LISP
e d i t o r , C a l l s on EDREAD a r e terminated by
altmode o r e l l i p s i s (, ,,). I f e l l i p s i s
i s used t h e nex,t c a l l an EDREAD w i l l
return. NIL; otherwise EDREAD r e t i n n s a
list of t h e elements typed sl.rbxtituting
$LP f o r (,$RP f o r ) and $D f o r
.
SUBR
W i l l work f o r atoms md p o s i t i v e f i x e d p o i n t numbers less t!.~anabout, 45651@lfi;
o t h e r w ~ s euse EQIJMI,
EQUAL
SUBR
F l o a t i n g p o i n t numbers a r e EQUAL, only i f
they are exacxly equal, To compare a
fixed t o a f l o a t i n g - p o i n t nunbe:,
first
f l o a t $ t h e f or me^ by p e r f orrning (PLTJS
f 2-xed-point nlmber #. $) .
ERRSET
FSUBR
(ERRSET a p r e s s ion a r g ) has t h e value
( e x p r e s s i o n ) ;r' !lo ei.rt?re occurs while
evalua+>ingaqexpression'u, I f an e r r o r
occlAr s n o t caused 3 y ERR, E-3RSET r e t u r n s
NILQ i f t k e e r r o r i s c a s e d by ERR, then
the val12.e i s that r e t u r n e d by ERR. LISP
err0.r w s s a g e s w i l l b~ prir?t,ed iff t h e
second argument, ''argq' i s T,
EVAL
LSUER
I f a second argument i s given i t i s used
i n s t e a d of t h e p r e s e n t "p a - l i s t " .
(EvAL
number) i s t h a t number.
Ir, e n t e r i n g a
f i l ~ : ~ i o narguments
,
a r e evaluated from
l e f c UG r i g h t .
(EVALatom) i s (CDR (GET
(QIJOTE atom) (QUOTEVALUE))), i m l e s s t h e r e
i s no VALUE p r o p e r t y o r t h e above comput?a't;ion.r e t u r n s t h e pseudo-atom L?NBOUND,
I n which case a LISP e r r o r occurs and t h e
offending atom i s p r i n t e d , followed by t h e
message 'UNBOUND VARIABLE -, EvAL."
(EVALx)
where x i s non-atomic and (CAR x ) i s atomic
proceeds a s follows : t h e i n t e r p r e t e r
determines GETL (QUOTECAR x) (QUOTE(SUBR
MPR FSUBR! I MPR LSUBR MACRO) ) ), or, i f
t h i s i s NIL, (EvAL (CAR x)). If x has no
VALUE prope.rty, a L E P e r r o r occurs and x
I
SAILON No. 28.1
i s p r i n t e d with t h e message "UNDEFLNED
FUNCTION," Having found a f u n c t i o n i t
then e v a l u a t e s i t s arguments i f approp r i a t e and a p p l i e s t h e f u n c t i o n t o them.
When (CAR x ) i s non-atomic i t immediately
e v a l u t e s t h e l i s t of arguments i . e . ,
(CDRx ) . It t h e n compares (CAM x ) t o
LAMBDA, LABEL and FUNARG, t a k i n g approp r i a t e a c t i o n i n each case. F a i l i n g t h i s ,
it a p p l i e s (EVAL (CAR x ) ) t o t h e members
of (CDRx ) .
EXAMINE
SUBR
Argument i s number, which i s taken a s
a b s o l u t e machine address; value i s
-- .,.'-2 of s a i d address a s a f i x e d
r, ,,
p o i n t number,
w.
J-
A
EXPLODE
SUBR
Argument i s s-expression; value i s l i s t
of atoms whose p r i n t names a r e s i n g l e
c h a r a c t e r s , which concatenated would form
t h e p r i n t name of t h e ar,gument.
For
example, (EXPLODE(QUOTEFOO)) has t h e
value (F 0 0 ) . EXPLODE l i k e PRIN1, i n s e r t s s l a s h e s , s o (EXPLODE (QUOTE(QUOTE
FOO/ B
@)
PRINl' s a s (F 0 0 // / BAR)
o r PRINCts a s (I? 0 0 / B A R ) .
EXPLODEC
SUBR
EXPLODEC i s t o EXPLODE a s PRINC i s t o
PRIN1. Example : (MPLODEC(QUOTEFOO/ BAR)-+)
would PRIN1 a s (F 0 0 / B A R ) or PRINC;
a s (F o o B A R).
EXPR
I n d i c a t o r f o r s-expression f u n c t i o n .
FEXPR
I ~ i i i c a t ~ of o
r r s-expressicn s p e c i a l form.
I t s lambda-list may have one o r two
members; t h e second i s bound t o t h e
current "a-list",
FIX
SUBR
Argument i s a f i x e d o r f l o a t i n g - p o i n t
number; value i s t r u n c a t e d f i x e d - p o i n t value
of argument.
I n d i c a t o r f o r a fixed-point number.
"Numbers".
SYM
See
(PUSHJ P F M ~ A )Turns t h e a c t u a l f i x e d
p o i n t number i n 1 i n t o a LISP number,
9-10
SAILON No. 28.1
FLAT SIZE
SUBR
I n d i c a t o r f o r f l o a t i n g - p o i n t number,
See "Numbers".
FLONUM
+ FORCE
SUBR
Causes t h e t e l e t y p e output b u f f e r t o be
p r i n t e d on t h e t e l e t y p e .
Storage a r e a i n LISP f o r .s-expressions.
Takes a l l memory which i s f r e e a f t e r t h e
f o u r o t h e r s t o r a g e a r e a s have been
a l l o c a t e d , See "Allocator".
Free Storage
FSUBR
I n d i c a t o r f o r special-form s u b r o u t i n e ;
the ::ex+ p o i n t e r on t h e p r o p e r t y l i s t
points t o the f i r s t instruction i n the
r o u t i n e . To u s e t h e c u r r e n t " a - l i s t "
a FSUBR must c a l l *AMAKE, which l e a v e s
a p o i n t e r t o same i n 2.
F u l l Word Space
Storage a r e a i n LISP f o r c h a r a c t e r s t r i n g s
of p r i n t naxes, f l o a t i n g - p o i n t numbers,
and n e g a t i v e f i x e d - p o i n t numbers, and
l a r g e p o s i t i v e f ixed-point numbers,
FUNARG
One of t h e t h r e e i n d i c a t o r s t h e i n t e ~ p r e t e r
looks f o r when e v a l u a t i n g a nonmatamic
s-expression with a non-atomic CAR.
FUNCTION
To t h e i n t e r p r e t e r , has t h e same e f f e c t
a s QUOTE. To t h e compiler, causes comp i l a t i o n of i t s argument,
SCGAG, :-;
SUBR
(GCGAGT ) p r i n t s s t a t i s t i c s a f t e r garbage
CO~II~CG~~~;.(G
NIL)
CGA
sil-es
G
*printout.
GC
SUBR
Takes no arguments, causes a garbage
c o l l e c t i o n , and r e t u r n s NIL.
GET
SUBR
(LAMBDA (A B)
(corn(
(m(CDR A ) ) NIL)
( (EQ (CADR A) B) (CADDR A) )
((GET (CDDRA)
~1)))
A t y p i c a l , use.
(GET (QUOTE atom) (QUOTE
i n d i c a t o r ) ), would r e t u r n t h e p r o p e r t y i f
i t was found o r NIL. If t h e p r o p e r t y
could be NIL, an amiguity could r e s u l t
i n t h e second case.
SAILON No. 28.1
GENSYM
SUBR
I f t h e argument i s NIL o r an i n t e g e r , 0
t h r u 6, then a generated symbol, G0001,
ARG05, e t c , w i l l be produced. To s e t t h e
i n i t i a l value f o r any of t h e s e 8 symbol
(CSYMF N C O l 0 )
g e n e r a t o r s u s e CSYM. E.G.
g i v e s (GENSYM 0 ) value a s FNCM, (CSYM
BOO01 NIL) g i v e s (GENSYM)value a s B0002.
See a l s o CSYM.
GETL
SUBR
S i m i l a r t o GET but second argument i s a
l i s t of i n d i c a t o r s . The value r e t u r n e d
i s e i t h e r NIL ( i n d i c a t i n g no p r c p e r t y
w i t h any of t h e d e s i r e d i n d i c a t o r s was
found) o r such t h a t (CAR(GETL . ) ) i.s
: A :-,.ator,
n
(cADR (GETL ...)) i s t h e
..
d
l
.
*
...
property, and (CDDR (GETL
)) i s the
r e s t of t h e p r o p e r t y l i s t . GETL l i k e
GET s t o p s a t t h e f i r s t s a t i s f a c t o r y p a i r
on t h e p r o p e r t y l i s t .
FSUBR
I f argument i s non-atomic, i t i.s r e p e a t e d l y
evaluated u n t i l it i s atomic. However, see
"Current ~ r o b l e m s " .
GREATERP
LSUBR
Takes m y number of argwnen.t;s; r e t u r n s T
only i f a r g l > arg2 > arq3
; returns
NIL otherwise,
IBASE
VALUE
Radlx of f i x e d - p o i n t number :i.nput.
be modified with SET&.
+ INITFN
SUBR
.. .
(INITFN (QUOTEFOO)) s e l e c t s FOO a s an
i n i t i a l i z a t i o n f u n c t i o n which i s evaluated
whenever a LISP e r r o r t o t h e o u t e r l e v e l
c3,.,
.
., ..,
( i n c l u d i n g BELL)
(INITFN) r e t u r n s t h e c u r r e n t l y s e l e c t e d
i n i t i a l i z a t i o n function.
see TERPRIl.
There a r e four f u n c t i o n s which c o n t r o l 1-0
i n t h e LISP system. They a r e : INC, OUTC,
INPUT, and OUTPUT. A l l i n p u t i n t h e LISP
system comes from t h e t e l e t y p e o r from
" t h e o t h e r i n p u t device".
The f u n c t i o n
INPUT determines what t h i s o t h e r device i s
and t h e f u n c t i o n I N C determines whether
i n p u t comes from t h e t e l e t y p e o r from t h e
secondary device. OUTPUT and QUTC a r e
e n t i r e l y analagous. The argument of INPUT
L
,:-
SUBR
May
.
re
.
SAILON No, 28.1
i s t h e name of t h e i n p u t device t o be
used.
I f t h e i n p u t device i s a DECtape
t h e name of t h e f i l e t o be read i s a l s o
required. Thus t o read f i l e FOOBAZ and
dectape d r i v e 3, t h e following could be
used:
(INPUT DTAJ : FOOBAZ)
Note t h a t t h e name of t h e device must be
followed by a colon and a space. The
value of i n p u t w i l l be T i f t h e device
i s a v a i l a b l e , and i n t h e case of DECtape,
o r disk, i f t h e f i l e c a n b e found. I f
e i t h e r of t h e s e conditions i s n o t s a t i s f i e d ,
an e r r o r message w i l l be p r i n t e d . The
c k c g: ' -:t h e source cf 'Input does ~ o t
occur a t t h e time t h e INPUT f u n c t i o n i s
used, t h e change a c t u a l l y t a k e s p l a c e when
t h e f u n c t i o n I N C i s executed with argument
T.
I N C with argument NIL w i l l cause i n p u t
t o be taken from t h e t e l e t y p e . An automatic (INC NIL) i s performed when LISP
r e a d s an end of f i l e from a DECtape, and
trjtli
i s p r i n t e d . OUTPUT works t h e same a s
INPUT except with t h e DECtape i f t h e f i l e
does n o t already e x i s t i t w i l l . be c r e a t e d .
Since t h e main LISP loop c o n s i s t s of
t h e cycle "REAC",
"EVAL", "PRINT",
it i s
p o s s i b l e t o read i n fimction d e f i n i t i o n s
)"
by saying " (INC (INPTfl DTA3 : FOOBAZ)
I f a f u n c t i o n i s t o perform i n p u t from
DECtape i t i s e a s i e s t t o have t h e f u n c t i o n
perform (INC T ) . The i n p u t device can
then be s p e c i f i e d before c a l l i n g t h e
f u n c t i o n and can e a s i l y be v a r i e d .
~ ' ! i e ; n a r e c e r t a i n d i f f e r e n c e s between
INPUT and OUTPUT and between I N C and OUTC.
INPUT can be given a s t r i n g of i n p u t
files.
(INC T) w i l l then cause a l l of
t h e s e f i l e s t o be read i n succession and
t h e (INC NIL) w i l l be performed only a f t e r
seeing t h e end of f i l e on t h e l a s t f i l e .
.
Thus t o read FOOl and F002 from DTA3 and
FOO3 from l o g i c a l device BAZ, use
(INPUT DTAJ : FOOl F002 BAZ : FOO3 )
OUTC t a k e s two arguments r a t h e r than
only one a s I N C does. Namely OWC i s
defined a s follows:
SALLON No. 28.1
1. (oUTC T T ) , output goes t o t h e device
and f i l e described i n t h e l a s t
(OUTPUT DEV: FILE) command.
(oUTC NIL T ) e n d - o f - f i l e on l a s t
2.
'"device and f i l e " .
Successive output
goes t o t h e t e l e t y p e .
3. (OWC NIL NIL) output changes t o t h e
t e l e t y p e from "device and f i l e " . No endo f - f i l e i s given.
4. (OUTCT NIL) output r e t u r n s t o
"device and f i l e " from t h e t e l e t y p e .
INTERN
SUBR
Argument i s p o i n t e r t o atom structure;
p u t s s a i d atom on OBLIST and r e t u r n s
( p ~ i ; h ~ l . 'new)
;r
atom p o j n t e r .
IMlM
SYM
The l a r g e s t fixed-point number which may
be r e p r e s e n t e d by no more l i s t s t r u c t u r e
than a " p o i n t e r t s one l a r g e r than i t s e l f .
See numbers.
LABEL
One of t h e i n d i c a t o r s which EVAL looks f o r
when e v a l u a t i n g an s-expression with a
non-atomic CAR,
LAMBDA
One of t h e t h r e e i n d i c a t o r s EVAL Looks f o r
when e v a l u a t i n g an s-expression wilcise CAR
i s non-at5omi.c.
LAP
LAP i s n o t p a r t of t h e LISP on the system
tape, but r a t h e r a s a f i l e of s-expressions
on t h e system tape a s f i l e LAP. (LAP name
i n d i c a t o r ) , where t h e i n d i c a t o r i s SUBR,
FSUBR, or LSUBR, causes LAP t o c a l l READ
~ c ~ ~ ~ e a - c e ceach
l l y , time reading one t a g o r
s t o r a g e word. An atom i s taken a s a tag,
except f o r NIL which i n d i c a t e s t h e end of
t h e f u n c t i o n being read; a non-atom sexpression i s taken a s a s t o r a g e word i n
e i t h e r t h e format ( 1 n s t Acc ~ d r o
) r the
format ( 1 n s t Acc Adr lndx)
I n s t should
be a PDP-6 i n s t r u c t i o n mnemonic, optiona l l y s u f f i x e d @ (e. g., HLRZ@) f o r t h e i n direct bit. Acc should be a number from
- 17, o r P, t h e r e g u l a r pushdown p o i n t e r .
Adr may be a numeric machine address, a
t a g i n t h a t function, a n e g a t i v e number,
one of c e r t a i n symbols f o r e n t r y p o i n t s
.
-
_V_
SAILON No. 28.1
t o LISP i n t e r n a l r o u t i n e s , o r a l i s t i n
one of t h e following forms: (QUOTEatom)
(SPECIAL
atom) f o r
f o r a ~ o i n t e rt o .atom;
.-'
a p o i n t e r t o atom's s p e c i a l c e l l (which i s
t h e CDR of t h e VALUE p r o p e r t y ) ; (E atom)
f o r a p o i n t e r t o t h e name of a f u n c t i o n
being c a l l e d ; o r ( C w x y z ) f o r a
p o i n t e r t o a constant, i . e . , a s t o r a g e
word c o n t a i n i n g (w x y z )
Indx i s an
o p t i o n a l l e f t - h a l f q u a n t i t y , such a s an
index r e g i s t e r s p e c i f i c a t i o n , of t h e
same form a s
A SUBR may have no
more than 5 arguments, t h e v a l u e s of
which a r e placed i n accumulators 1
.-." 5 when t h e SUER is c a l l e d ,
A
pol-nter t o t h e argument l i s t of an FSUBR
i s i n 1. The arguments of an LSUBR a r e
on t h e r e g u l a r pushdown l i s t , l a s t on top,
and - (number of arguments) i s i n 6.
A@cumulatoss 1 through 7 are th.e ONLY
a c c ~ m u l a t o r sa v a i l a b l e f o r use w i t h i n a
subroutine, which i s expected t o r e t u r n
i t s value i n accumulator 1. (PUSHJ P *-)
w i l l r e t u r n a p o i n t e r t o Lhe " a - l i s t " i n
acemu1a;t or 2.
A
.
&.
I
,
-
Thus, a t y p i c a l usage of LAP t o g e t a
hand-,coded f u n c t i o n :iln,to t h e sys tern would
be:
(LAP ABS SUBR)
(PUSHJ P ~ A L )
(MOWS 1 )
(JCALL 2 (E MAKNUM) )
NIL
Four WO ( t r a p ) i n s t r u c t i o n s a r e a v a i l a b l e f o r LAP: CALL, JCALL, CALW and
JCALLF. These a r e t o be used f o r f u n c t i o n
c a l l s i n t h e form (CALL n (E f n ) ) where
n
- i s a s follows: @ through 5, c a l l i n g a
SUBR or MPR with @ t o 5 arguments; 16
o c t a l , c a l l i n g LSUBR with arguments on
pushdown l i s t and - (number of arguments)
i n accumulator 6; 17 octal., c a l l i n g an
FSUBR o r FEXPR with p o i n t e r t o argument
l i s t i n 1,
When one of t h e s e WOs i s f i r s t executed,
t h e WO handler w i l l c a l l t h e i n t e r p r e t e r
i f c a l l i n g an MPR o r FMPR, otherwise i n
t h e case of CALLF o r J C m w i l l execute
a PUSHJ o r JRST, r e s p e c t i v e l y , t o tihe
s p e c i f i e d function, and i n t h e case of
CALL o r JCALL w i l l execute t h e PUSHJ o r
JRST but i n a d d i t i o n w i l l change t h e UUO
t o a PUSHJ o r JRST u n l e s s (NOWO T ) has
been evaluated.
The F forms a r e necessary Lo c a l l f u n c t i o n s
whose names a r e computed; t h e J forms save
code i n t h e case of (RETURN ( f n
.)).
..
LAST
SUBR
LENGTH
SUBR
LESSP
LSUBR
Takes any number of arg.uments, r e t u r n s T
only i.f a r g l <arg2 <arg3
e t c . , and
NIL otherwise.
SUBR
I f t h e argument i s NIL r e t u r n t h e c u r r e n t
l i n e length. If t h e argument i s a number,
t h e l i n e l e n g t h i s s e t t o t.nis value.
LIST
FSUBR
(LAMBDA (A) (MAPCAR (FUNCTIONEVAL)A ) )
LSH
SUBR
Logical l e f t s h i f t of t h e value of t h e
f i r s t argument by n places, where n is
t h e value of t h e second argument, which
m&.y b y ~ e g a t i v e .
LSUBR
...
I n d i c a t o r f o r s u b r o u t i n e f u n c t i o n which
may t a k e any number of arguments which
a r e placed on t h e r e g u l a r push down l i s t ,
l a s t on top. The n e g a t i v e number of
arguments i s placed i n accumulator 6. I n
an s-expression f u n c t i o n , t h e n o t a t i o n
( L A M B Dvar
A
) where t h e "LAMBDA-lis t"
i s an atom, i n d i c a t e s t h a t t h e v a r i a b l e
var i s t o be bound t o t h e number of
argumects, and t h e values o f t h e arguments may be g o t t e n by c a l l i n g (ARG l),
(ARG 2 ) , e t c .
. ..
SAILON No. 28.1
Indicator of a MACRO property, simulated
by the interpreter and expanded at compile
time. The property should be a function
of one argument. When a call to this
function is encountered, the list which is
the function call (i.e., CAR of it is the
function name) is fed to the macro definition as the one argument. Then the MACRO
property function is expanded, for example:
MACRO
(DEFPROP CONSCONS
(LAMBDA (A)
(corn
MACRO)
( ( ~ ( C D D R A)) (CADR A))
((LIST (QUOTE CONS)
(CADR A)
(CONS (CAR A)
( ( c Q A~)))))
would cause (CONSCONS A B C) to expand
first, to (CONS A (CONSCONS B c)), then
to (CONS A (CONS B c)), which is what
would be interpreted or compiled.
SUBR
Argument is list of atoms whose print
names are single characters (actually it
takes the first character of each print
name); value is pointer to s-expression
which if printed out, would be the concatenation of the single characters which
were its arguments.
SUBR
Turns the pointer which is its first
argument into a LISP fixed - o r floatingp o i ~ - i tfiljmber,according as whether its
second argument evaluates to FZXNUM or
FLONUM*
SUBR
First argument is function; second is
argument list. Returns NIL, does no
CONSes, otherwise identical to MAPCAR.
:*-
'
8
-
MAPCAR
SUBR
First argument is function; argument is
second.
MAPLIST
SUBR
Function is first argument; ar,gment
is second.
list
SAILON No. 28.1
MEMBER
SUBR
Uses EQUAL.
MEMQ
SUBR
Like MEMBER, but uses EQo
MINUS
SUBR
-
MINUSP
SUBR
Returns T if argument is less than
NCONC
LSUBR
Takes any number of arguments.
x.
is NIL. (NCONC x) is EQ to -
NCONS
SUBR
( ~ D (A)
A (CONS A NIL))
NIL
VALUE
False value of predicates, explicitly
,
f ~ by
r COND. ( E V NIL)
~
is NIL
(NI~ILex nihilo). (MAKNUM NIL (QUOTE
(FMNUFI) is @.NIL ends lists.
(argunent).
#.
(NCONC)
%.
NOT
SUBR
Identical in value to NULL.
NOUUO
SUBR
(NOWO T) prohibits the UUO handler from
changing CALLS and JCALLs to WSHJs and
JRSTs, enabling tracing of the functions
so called. (NOWO
NIL) restores that
ability,
NSTORE
FSUBR
(NSTORE (NAME indxi indx2
) number)
stores number in the array element
specified. This differs from STORE in
that the number is not in LISP number
format, NSTOW evaluates its second
argument first and returns as value the
second argument as with SETQ,
NULL
SUBR
( b w ~ ~ \(A)
li
NUMBERP
SUBR
Returns T if its argument is a number;
NIL otherwise,
Numbers
Positive fixed-point numbers less than about 4$$$
decimal are represented by "pointersn one greater
than their value and no further list structure.
Floabing-point numbers and other fixed-point numbers
are represented by atom structures whose property
list contains a pointer to either one indicator
F M U M or the indicator FLONUM, and a pointer to a
word in Full Word Space containing the actual number.
For numeric input, see READ. Numeric output for
...
(EQ A NIL) )
SAILON No. 28.1
f l o a t i n g - p o i n t i.s decimal; otherwise, i s i n r a d i x
BASE, and i f t h a t r a d i x i s 1/6 decimal, LISP w i l l
end t h e number w i t h a decimal p o i n t u n l e s s *NOPOINT
has been s e t t o T. The a r i t h m e t i c f u n c t i o n s (except
MINUS) t a k e any number of arguments, and use f i x e d point arithmetic u n t i l the f i r s t floating-point
operand i s encountered, a t which time t h e c u r r e n t
r e s u l t and a l l succeeding f i x e d - p o i n t operands a r e
f l o a t e d , and t h e r e s u l t i s f l o a t i n g - p o i n t .
NUMVAL
SYM
(PUSHJ P NUMVAL) w i t h a LISP number i n 1
r e t u r n s a machine ln.u.-dber i n 1.
OBLIST
VALUE
The o b j e c t l i s t , a l i s t of bu.ckets of
OPS
FEXPR
o r FSUBR P a r t of LAP. Takes p a i r s of
arguments of t h e form sym value, g i v e s
sym a SYM p r o p e r t y of value,
each -
FSUBR
Takes any number of arguments; r e t u r n s
f i r s t non-NIL argument o r NIL; does n o t
e v a l u a t e arguments p a s t t h e one it
returns.
LSUBR
a r g l e arg2
PLUS
+
arg3
...
I n d i e a t o r f o r p r i n t name property. The
p r o p e r t y 5,s a l i s t of p o i n t e r s t o words
i n f u l l word space c o n t a i n i n g t h e a c t u a l
character string,
PNAME
PRINC
SUBR
P r i n t s any s-expression; does n o t i n s e r t
s l a s h e s before c h a r a c t e r s which must be
q:Lc:ueJ v i t h a s l a s h 0.2 type-in.
PRINC
does n o t p r i n t a space b e f o r e o r a f t e r
what i t p r i n t s .
PRINT
SUBR
(TERPRI) ( P R I N ~ a r g )
Identical. t o (PROG~
(PRINC (QUOTE/ ) ) ) .
PRINl
SUBR
P r i n t s any s-expression; i n s e r t s s l a s h e s
before c h a r a c t e r s ,which would otherwise
be s y n t a c t i c a l l y i n c o r r e c t a s p a r t of an
atom's p r i n t name such a s +, ( e t c .
SAILON No. 28.1
be s y n t a c t i c a l l y i n c o r r e c t a s
atom's p r i n t name, such a s an
may be quoted
d i g i t or (or
i t s e l f may be
character /
t h i s way.
.'?
p a r t of an
initial
with t h e
quoted
I f an i l l e g a l atom occurs while typing,
(e. g., 8~),READ w i l l e n t e r a e ell"
loop and w i l l ignore a l l c h a r a c t e r s
except rubout and B e l l . Rubout w i l l
e r a s e t h e i l l e g a l atom and r e t u r n c o n t r o l
t o READ, Y 1 ~ e l la"s u s u a l w i l l r e t u r n
control t o the top level,
READCH
-AE,-,:!s
SUBR
? e c h a r a c t e r from t h e s e l e c t e d
i n p u t devize; see "~nput-Output". The
v a r i o u s c h a r a c t e r s which c o n t r o l LISP's
input-output switches a r e seen and
t r e a t e d a s any o t h e r c h a r a c t e r s , but
s t i l l have t h e i r u s u a l e f f e c t s .
SUBR
S i m i l a r t o MAKNAM q.v.
- but automatically
INTERNS any atoms appearing i n t h e
r e s u l t i n g s-expression,
,
Regular Push Down L i s t Storage a r e a i n LISP c o n t a i n i n g r e t u r n s f o r
f u n c t i o n c a l l s and bindings of a l l l o c a l v a r i a b 1 . e ~ .
Normally c o n t a i n s 1$$@
registers.
FEXPR
P a r t of LAP. REMOBS a l l f u n c t i o n s
a s s o c i a t e d w i t h LAP. With an o p t i o n a l
argument of T, removes t h e SYM p r o p e r t y
of a l l atoms which possess i t ,
FSUBR
i'akes m y number of atomic arguments ;
removes them from t h e OBLIST and
r e t u r n s NIL.
SUBR
Removes t h e p r o p e r t y w i t h t h e i n d i c a t o r
which i s t h e value of i t s second argument from t h e atom which i s t h e value of
i t s f i r s t argument. Returns T i f t h e
p r o p e r t y was t h e r e , and N I L otherwise.
RETURN
SUBR
See "Current Problems".
REVERSE
SUBR
Reverses t h e t o p l e v e l of a l i s t , using
CONS.
SUBR
,
Replaces CA.2 of t h e v,lue o f i t s
argument w i t h t h e v a l u e o f i t s second
argument.
RPWD
SUBR
Same a s RPLACA, b u t u s e s CDR.
SASSOC
SUBR
Uses EQ.
SET
SUBR
Causes t h e v a l u e of i t s second argument
t o be p l a c e d , w i t h RPLACD, i n CDR o f t h e
VALUE p r o p e r t y o f t h e v a l u e o f i t s f i r s t
argument.
SETQ
FSUBR
(SET (QUOTEa r g l ) arg2).
SPEAK
SUBR
SPECIAL
'
J-~L,
argumen ls, ~ L u r n sc u r r e n t
v a l u e o f CONS c o u n t e r .
7'1
L,LLG,
SYM
(PUSHJ P SPECRIND) (@$ v a r l ) ( @n v a r 2 )
c a u s e s $he c u r r e n t b i n d i 2 g o f t h e s p e c i a l
v a r i a b l e s v a r l and -v a r 2 t o be saved upon
t h e S p e c i a l Push Down L i s t , and c a u s e s
v a r l t o be bound t o NIL and v a r 2 t o be
bound t o t h e c o n t e n t s of accumulator n.
FEXPR
P a r t of t h e c o m p i l e r , D e c l a r e s a l l o f
t h e atoms which a r e i n i t s i i s t o f
a r g m e n t s t o be SPECIAL.
all
f r e e v a r i a b l e s i n compiled f u n c t i o n s a r e
a u t o m a t i c a l l y s p e c i a l , There i s no
UNSPECIAI,; u s e (REMPROP(QUOTE a t om)
(QUOTESPECIAL).
.. .
ow ever,
S p e c i a l Push Down L i s t s t o r a o T.TSP where h i e h e r - > e v e 1 b i n d i n g s o f
. .
; p i c i d . A L LLLLII-S are s t o r e d . N o r m ~ l l yI.@@@
r e g i s t e r s long,
SPECSTR
SYM
(PIJsHJ P SPECSTR) r e s t o r e s most r e c e n t
batch of s p e c i a l y a r i a b l e bindings.
STOm
FSUBR
) value) s e t s
(STORE (name i n d x l indx2
the value of the specified c e l l i n the
a r r a y name t o t h e v a l u e v a l u e . See
"ARRAY". E v a l u a t e s i t s second argument
SUBR
...
Indicator f o r subroutine function property,
P r o p e r t y i s p o i n t e r t o cirst i n s t r u c t i o n
i n routine.
SUBR
STJBST
Uses CONSes. Use (SUBST
t h e value of arg.
$
a r g ) t o copy
rCP
\
SUB1
SUBR
I
Value i s f i x e d o r f l o a t i n g , same a s
argument.
I n d i c a t o r f o r symbol value property.
Used by LAP,
SVM
VAL1JB
True value of p r e d i c a t e s .
(EVAL T) i s
T ( ~ e r i t a snumquam p e r i t ) .
SUBR
Takes no arguments; p r i n t s a c a r r i a g e ret11r.~-1
ine-feed, and r e t u r n s NIL.
SUBR
Like TEWX except it w i l l p r e f a c e each
l i n e with an EDIT2 line number. Use
INN0 t o i n i t i a l i z e numbering.
:;UBH
Returns i n f i x e d p o i n t t h e number of
m i l l i s e c o n d s your job has been computing.
LSU BX
argl
SU13H
1,ogical i n v e r s e of TYO, i e , i n p u t s
a s i n g l e c h a r a c t e r i n ASCII code.
SCJRR
0u:puts t h e c h a r a c t e r whose ASCII value
i s t h e value of i t s one argument.
*
arg2
*
.
arg3 ,
.
I n d i c a t u r f o r value property. The value
c e l l / s p e c i a l c e l l i s CDR of t h e VALUE
property,
XCONY
SLIER
(CONS arg2 a r g l )
SYM
(PUSHJ P *AM,NU3) r e t u r n s a p o i n t e r t o
t h e c u r r e n t " a - l i s t " i n 2.
SUBR
DIFFERENCE of two arguments,
SUBR
EVAL of 1 argument.
SAILON No. 28.1
SUBR
Causes FUNARG binding when encountered;
otherwise identical to FUNCTION.
SUBR
GREATERP of :two arguments.
SYM
( J S P . *LCW)
~
in an LSUBR which has been
called by the interpreter puts the number
of arguments in 1, and a pointer to the
arguments on the top of push down list.
SUBR
LESSP of two arguments.
VALUE
When set to T, inhibits the printing of
decimal points after typeout of decimal
numbers. 'Setting *NOPOINT to NIL restores this typeout.
SUBR
PLUS of two arguments.
SUBR
QUOTIENT of two arguments.
SUBR
(*RSET T) inhibits the rebinding of
special variables to top-level values
when a LISP error occurs; (*RSET NIL)
permits this rebinding.
SUBR
TIMES of two arguments.

Similar documents

Stanford LISP 1.6 Manual - Software Preservation Group

Stanford LISP 1.6 Manual - Software Preservation Group This manual i s intended t o e x p l a i n t h e i n t e r a c t i v e LISP 1.6 system which has been developed f o r t h e P D P - ~ / ~ O a t t h e Stanford U n i v e r s i t y A r t i f i c i a ...

More information