Page Numbers: Yes X: 306 Y: 1.0" First Page: 13
Margins: Top: 1.0" Bottom: 1.3"
Heading:
CS-370 (FALL 1982)3-LISP REFERENCE MANUALNovember 1, 1982
———————————–
5. Standard Procedures
———————————–
There are about 150 standard procedures in 3-LISP: procedures that are described in this reference guide, used without comment in utility packages, and so forth (we also expect to ‘compile’ these procedures into the standard implementation). A 3-LISP programmer should consider these to be the base set, on top of which to define other functionality as desired. Within the set of standard procedures, however, there are two important sub-classes:
1.Primitive: There are thirty-three 3-LISP procedures (listed in section 5.a) that have no definition within 3-LISP, all of which are simple (i.e., there are no primitive reflectives). To a certain extent the definition of this set is arbitrary, and the current set is not minimal: SCONS, for example, could be defined in terms of RCONS; LENGTH could be defined in terms of EMPTY and +; etc.
2.Kernel: The kernel procedures are those that are used crucially in the 3-LISP processor. As a consequence, smashing one of these closures, or redefining the binding in the global environment, will cause the tower to fall. Thus for all practical purposes the kernel procedures are as ‘wired-in’ to 3-LISP’s as are the primitives, even though in a strict sense they have visible definitions. Examples include NORMALISE, BINDING, and LAMBDA.
These sets are not neither mutually exclusive nor exhaustive: many of the primitives are kernel procedures as well (EMPTY, for example), but there are some non-kernel primitives (LENGTH, >, ACONS, REPLACE, etc.). In addition, it is clear that many kernel procedures are not primitive (LAMBDA, BINDING, NORMALISE, and NORMAL, to name a few). Finally, there are about 50 other standard procedures (MAX, LABELS, DO, etc.) that are neither primitive nor kernel.
5.a. Primitives
CategoryStandard NameFunctionality
Typing:TYPEdefined on 15 types (9 internal, 6 external)
PROCEDURE-TYPEto distinguish simple and reflective closures
Identity:=defined on 14 types (all except functions)
Structural:PCONS, CAR, CDRto construct and examine pairs
CCONS, ENV, PATTERN, BODYto construct and examine closures
ACONSto construct atoms
RCONS, SCONS, PREPto construct rails and sequences
LENGTH, NTH, TAIL, EMPTY to examine " " "
HASHto index structures of all sorts
Modifier:REPLACEto modify mutable structures
Control:EFan extensional if-then-else conditional
Semantics:UP, DOWNto mediate between sign & signified
Arithmetic:+, -, *, /, <, >, RANDOMas usual
I/O:INPUT, OUTPUTprimitive operations on streams
Reflection:LEVELthe current reflective level
The following kernel functions need not be primitive; they are defined in the reflective model in terms of the above:
DEFINE—A macro defined in terms of SET and the Y-OPERATOR
LAMBDA—A reflective closure that uses CCONS
NORMALISE—See the reflective processor
REDUCE—See the reflective processor
SET—Reflective procedures using REPLACE on the environment designator
BINDING—Simple scan of the environment
MACRO—Simple function constructing a reflective closure
READ—Defined using INPUT over streams
PRINT—Defined using OUTPUT over streams
SIMPLE—Simple function that uses CCONS
REFLECT—Simple function that uses CCONS