Page Numbers: Yes X: 306 Y: 1.0" First Page: 47
Margins: Top: 1.0" Bottom: 1.3"
Heading:
STANDARD PROCEDURE GUIDE3-LISP REFERENCE MANUAL April 16, 1984
————————————————————————————————————————————
2.d. EXPLICIT SEMANTICS
————————————————————————————————————————————
2.d.1. SEMANTIC OPERATORS
————————————————————————————————————————————
(UP S)
↑S
Designates the form to which S normalises. ‘↑S’ expands to (UP S) in the standard notation. Note that UP, although it is not a reflective procedure, is nonetheless not strictly extensional, since what it designates is a function not only of its arguments’ designation, but also of its argument’s procedural consequence (what it returns).
F-Type: [ OBJECTS ] ← STRUCTURES Properties: Primitive; kernel.
Examples:↑5g’5
↑(+ 2 3)g’5
↑(LAMBDA [X] X)g’{closure}
[’(= 2 3) ↑(= 2 3)]g[’(= 2 3) ’$FALSE]
(LET [[X [2 3]]] (= X [2 3]))g$TRUE
(LET [[X [2 3]]] (= ↑X ↑[2 3]))g$FALSE
(DOWN S)
↑S — (notated ‘\S’ in standard ASCII)
If S designates a normal-form designator R, then (DOWN EXP) designates the designation of R, and therefore normalises to R. ‘↑S’ expands to ‘(DOWN S)’ in the standard notation.
F-Type: [ STRUCTURES ] ← OBJECTS Properties: Primitive; kernel.
Examples:↑’4g4
↑(NTH 2 ’[10 20 30])g20
↑3g{ERROR: Structure expected.}
↑↑$TRUEg$TRUE
↑’Xg{ERROR: Normal form structure expected.}
(DESIGNATION EXP ENV)
If EXP designates R and R normalises to R’ in the environment designated by ENV, then (DESIGNATION EXP ENV) will return R’. Thus DESIGNATION can obtain the referent of any structure, whereas DOWN is restructed to normal-form structures.
F-Type: [ STRUCTURES X ENVIRONMENTS ] ← OBJECTS
Properties: (Arbitrary effects due to sub-normalisation).
Examples:(DESIGNATION ’1 GLOBAL)g1
(LET [[X ’1]
[Y ’X]]
(DESIGNATION Y (CURRENT-ENVIRONMENT)))g’1
————————————————————————————————————————————
2.d.2. PROCESSOR
————————————————————————————————————————————
(NORMALIZE STRUCTURE ENV ESC CONT)
Normalizes the structure designated by STRUCTURE in the environment designated by ENV with escape designated by ESC and continuation designated by CONT. Under normal circumstances, the normal-form designator that results from this normalisation will be passed as the single argument to the continuation. Error if EXP does not designate a structure.
F-Type: [ STRUCTURES X ENVIRONMENTS X FUNCTIONS X FUNCTIONS ] ← STRUCTURES
Properties: Kernel; CPS.
Examples:Assume that SE is bound to STANDARD-ESCAPE:
(NORMALIZE ’1 GLOBAL STANDARD-ESCAPE ID)g’1
(NORMALIZE
’X (BIND ’X ’1 ↑(ECONS)) STANDARD-ESCAPE ID)g’1
(NORMALIZE ’(+ 2 2) GLOBAL STANDARD-ESCAPE ID)g’4
(DEFINE QUOTE
(RLAMBDA [CALL ENV ESC CONT]
(CONT ↑(ARG 1 CALL))))g’QUOTE
(NORMALIZE ’+ GLOBAL STANDARD-ESCAPE QUOTE)g’RESULT
(NORMALIZE ’$TRUE GLOBAL STANDARD-ESCAPE QUOTE)g’STRUCTURE
(REDUCE PROC ARGS ENV ESC CONT)
Reduces the referent of the structure designated by PROC with the referent of the structure designated by ARGS in the environment designated by ENV with escape designated by ESC and with continuation designated by CONT. Under normal circumstances, the normal-form designator that results from this process will be passed as the single argument to the continuation.
F-Type: [ STRUCTURES X STRUCTURES X ENVIRONMENTS X FUNCTIONS X FUNCTIONS ] ← STRUCTURES
Properties: Kernel; CPS.
Examples:Assume that SE is bound to STANDARD-ESCAPE:
(REDUCE
’+ ’[2 2] GLOBAL STANDARD-ESCAPE ID)g’4
(REDUCE ’IF ’[$TRUE 1 2] GLOBAL
STANDARD-ESCAPE ID)g’1
(REDUCE ’+ ’[2 2] GLOBAL SE
(MLAMBDA [X] ↑X))g’(CONT ’4)
(READ-NORMALIZE-PRINT LEVEL ENV STREAM)
Starts a READ, NORMALIZE, PRINT loop with ENV designating the initial environment. STREAM designates the stream through which this driver loop communicates; the designation of LEVEL is used as a (hopefully unique) identifying prompt. Under normal circumstances, READ-NORMALIZE-PRINT will not terminate.
F-Type: [ OBJECTS X SEQUENCES X STREAMS ] ← OBJECTS Properties: CPS .
Examples:1> (READ-NORMALIZE-PRINT ’NEW GLOBAL PRIMARY-STREAM)
’NEW> (+ 2 2)
’NEW= 4
’NEW> ; This level is just as good as the old one.
(STANDARD-ESCAPE ... <<<7 ARGS>>> ... )
The simple escape function that prints a minimal error message and starts a new READ-NORMALIZE-PRINT loop. <<< Still to be documented >>>
F-Type: [ <<<7 ARGS>>> ] Properties: CPS .
Examples:1> (NORMALIZE ’LSDJDSLF GLOBAL STANDARD-ESCAPE ID)
<<<ERROR MESSAGE>>>
1>
(ERROR E1 E2)
Causes NORMALIZE to call the escape function. <<< Still to be documented >>>
F-Type: [ OBJECTS X OBJECTS ] Properties: CPS .
Examples:1> (NORMALIZE ’(ERROR "FIRST THING" "SECOND THING") STANDARD-ESCAPE ID)
<<<ERROR MESSAGE>>>
(TRAP E1 E2)
Just like ERROR except that the second parameter is not normalized. <<< Still to be documented >>>
F-Type: [ OBJECTS X OBJECTS ] Properties: CPS .
Examples:1> (NORMALIZE ’(TRAP "FIRST THING" "SECOND THING") STANDARD-ESCAPE ID)
<<<ERROR MESSAGE>>>
(CPS-ERROR-PROTECT <<<???>>>)
<<< Still to be documented >>>
F-Type: [ OBJECTS X OBJECTS ] Properties: CPS .
Examples:1>
IT
IT is bound to the result of the last last thing normalized by READ-NORMALIZE-PRINT.
F-Type: OBJECTS
Examples:1> (CONS ’A ’[])
1= ’[A]
1> IT
1= ’[A]
————————————————————————————————————————————
2.d.3. SYSTEM UTILITIES
————————————————————————————————————————————
VERSION-ID
Designates a character string that identifies the version of the 3-LISP implementation.
F-Type: STRINGS
Example:1> VERSION-ID
1= "version 0.99 March 31, 1984"
(LOAD FILENAME)
Loads 3-LISP expressions from the file named by the string designated by FILENAME. The expressions are internalized, normalized, and their results printed (to the primary stream).
F-Type: [ STRINGS ] ← STRUCTURES Properties: Primitive; I/O.
Example:1> (LOAD "{Turing}<church>lambda.3-lisp")
... the contents of the file are read in at this point ...
1= ’OK
(RESET)
RESET restores the 3-LISP system to its initial state (producing the "1> " prompt) by immediately discarding the state of the computation (at all levels). The bindings of global variables are not affected in any way.
F-Type: [ ] ← Properties: Primitive.
Example:92> (+ 2 (RESET))
1= ’reset
1>
(LOGOUT)
LOGOUT terminates the session with the 3-LISP system. Before doing this, be sure to save any work that you have in your editor buffers. After logging out, the machine in placed in a state waiting for another user to come along.
(RUNTIME)
F-Type: [ ] ← NUMBERS Properties: Primitive.
RUNTIME designates the number of milliseconds that have elapsed since some arbitrary (but fixed) instant in the past.