Page Numbers: Yes X: 306 Y: 1.0" First Page: 82
Margins: Top: 1.0" Bottom: 1.3"
Heading:
STANDARD PROCEDURE GUIDE3-LISP REFERENCE MANUALJanuary 26, 1983
————————————————————————————————————————————
9.o. OTHER GENERAL UTILITIES
————————————————————————————————————————————
(ID E)
ID designates the single argument identity function. (ID E) returns what E normalises to.
Properties:Protected.
F-Type:[ OBJECTS ] ← OBJECTS
Examples:(ID 3)g3
(ID (+ 2 2))g4
(ID ’(+ 2 3))g’(+ 2 3)
(ID ID)g{simple ID closure}
Semantics:S(E0("ID),E,F,C) = l ...
———————————————————
(ID* E1 E2 ... EK)
ID* designates the multi-argument identity function. (ID . E) returns what E normalises to.
Properties:Protected.
F-Type:OBJECTS ← OBJECTS
Examples:(ID* 3)g[3]
(ID* (+ 2 2) (TYPE ’1))g[4 ’NUMERAL]
(ID* ’(+ 2 3))g[’(+ 2 3)]
(ID* . GLOBAL)g{global}
(ID* . (+ 2 2))g4
Semantics:S(E0("ID*),E,F,C) = l ...
———————————————————
(REFERENT EXP ENV)
Designates the object to which the structure that EXP designates normalises to in the environment designated by ENV.
Properties:Cons; I/O; smash.
F-Type:[ STRUCTURES X SEQUENCES ] ← OBJECTS
Examples:(REFERENT ’1 GLOBAL)g1
(REFERENT ’X [[’X ’1]])g1
(REFERENT ’’(+ 2 2) [])g’(+ 2 2)
(REFERENT (PCONS ’+ ’[2 2]) GLOBAL)g4
Semantics:S(E0("REFERENT),E,F,C) = l ...
———————————————————
(MACRO-EXPANDER FUN)
FUN must normalise to a closure that was generated with MACRO. Designates a function that will perform the macro expansion entailed in normalising a call to FUN.
F-Type:[ FUNCTIONS ] ← FUNCTIONS
Examples:((MACRO-EXPANDER DELAY) ’[(FOO X)])g’(LAMBDA SIMPLE [] (FOO X))
((MACRO-EXPANDER FORCE) ’[DUMBO])g’(DUMBO)
Semantics:S(E0("MACRO-EXPANDER),E,F,C) = l ...
————————————————————————————————————————————
9.p. PROCESSOR
————————————————————————————————————————————
(NORMALISE EXP ENV CONT)
Normalises the structure designated by EXP in the environment designated by ENV with 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.
Properties:Protected; kernel; CPS; smash; cons; I/O.
F-Type:[ STRUCTURES X SEQUENCES X FUNCTIONS ] ← ???
Examples:(NORMALISE ’1 [] ID)g’1
(NORMALISE ’X [[’X ’1]] ID)g’1
(NORMALISE ’(+ 2 2) GLOBAL ID)g’4
(NORMALISE ’+ GLOBAL
(LAMBDA MACRO [X] ↑X))g’(BINDING EXP ENV)
(NORMALISE ’$T GLOBAL
(LAMBDA MACRO [X] ↑X))g’EXP
Semantics:S(E0("NORMALISE),E,F,C) = l ...
———————————————————
(REDUCE PROC ARGS ENV 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 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.
Properties:Protected; kernel; CPS; smash; cons; I/O.
F-Type:[ STRUCTURES X STRUCTURES X SEQUENCES X FUNCTIONS ] ← ???
Examples:(REDUCE ’+ ’[2 2] GLOBAL ID)g’4
(REDUCE ’IF ’[$T 1 2] GLOBAL ID)g’1
(REDUCE ’+ [2 2] GLOBAL
(LAMBDA MACRO [X] ↑X))g’↑(↑PROC! . ↑ARGS!)
Semantics:S(E0("REDUCE),E,F,C) = l ...
———————————————————
(NORMALISE-RAIL RAIL ENV CONT)
Normalises the rail designated by RAIL in the environment designated by ENV with continuation designated by CONT. Under normal circumstances, the normal form rail that results from this processing will be passed as the single argument to the continuation.
Properties:Protected; kernel; CPS; smash; cons; I/O.
F-Type:[ RAILS X SEQUENCES X FUNCTIONS ] ← ???
Examples:(NORMALISE-RAIL ’[1] [] ID)g’[1]
(NORMALISE-RAIL ’[X X] [[’X ’1]] ID)g’[1 1]
(NORMALISE-RAIL ’[(+ 2 2)] GLOBAL ID)g’[4]
(NORMALISE-RAIL ’[+] GLOBAL
(LAMBDA MACRO [X] ↑X))g’(PREP FIRST! REST!)
(NORMALISE-RAIL ’[] GLOBAL
(LAMBDA MACRO [X] ↑X))g’(RCONS)
Semantics:S(E0("NORMALISE-RAIL),E,F,C) = l ...
———————————————————
(READ-NORMALISE-PRINT LEVEL ENV STREAM)
Starts a READ, NORMALISE, 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-NORMALISE-PRINT will not terminate.
Properties:Protected; smash; cons; I/O.
F-Type:[ OBJECTS X SEQUENCES X STREAMS ] ← ???
Examples:1> (READ-NORMALISE-PRINT ’NEW GLOBAL PRIMARY-STREAM)
’NEW> (+ 2 2)
=> 4
’NEW> ; This level is just as good as the old one.
Semantics:S(E0("READ-NORMALISE-PRINT),E,F,C) = l ...
———————————————————
(NORMAL S)
True just in case S designates a normal-form internal structure.
Properties:Protected; kernel.
F-Type:[ STRUCTURES ] ← TRUTH-VALUES
Examples:(NORMAL ’3)g$T
(NORMAL ’(+ 2 3))g$F
(NORMAL ↑(+ 2 3))g$T
(NORMAL ’[1 2 3])g$T
(NORMAL ’[1 2 A])g$F
(NORMAL ’A)g$F
(NORMAL ’’A)g$T
Semantics:S(E0("NORMAL),E,F,C) = l ...
———————————————————
(NORMAL-RAIL RAIL)
True just in case RAIL designates a normal-form rail.
Properties:Protected; kernel.
F-Type:[ RAILS ] ← TRUTH-VALUES
Examples:(NORMAL-RAIL ’[])g$T
(NORMAL-RAIL ’[1 $T #C])g$T
(NORMAL-RAIL ’[1 2 A])g$F
Semantics:S(E0("NORMAL-RAIL),E,F,C) = l ...
———————————————————
(PRIMITIVE CLOSURE)
True just in case CLOSURE designates one of the 30 or so primitive closures; false otherwise.
Properties:Protected; kernel.
F-Type:[ CLOSURES ] ← TRUTH-VALUES
Examples:(PRIMITIVE ↑+)g$T
(PRIMITIVE ↑NORMALISE)g$T
Semantics:S(E0("PRIMITIVE),E,F,C) = l ...
———————————————————
PRIMITIVE-CLOSURES
This variable designates the sequence of primitive closures.
Properties:Protected variable; kernel. (Not protected in current implementation!)
F-Type:SEQUENCES
Examples:(MEMBER ↑EF PRIMITIVE-CLOSURES)g$T
(MEMBER ↑IF PRIMITIVE-CLOSURES)g$T
Semantics:S(E0("PRIMITIVE-CLOSURES),E,F,C) = l ...
———————————————————
GLOBAL
This variable designates the global environment, the sequence of variable bindings shared across all reflective levels.
Properties:Protected variable.
F-Type:SEQUENCES
Examples:1> (SET X ’[HORTUS SICCUS])
=> ’OK
1> (BINDING ’X GLOBAL)
=> ’’[HORTUS SICCUS]
1> (DEFINE LAST
(LAMBDA SIMPLE [S]
(IF (UNIT S) (1ST S) (LAST (REST S)))))
=> ’LAST
1> (LAST GLOBAL)
=> [’LAST ’{closure SIMPLE ... [S] (IF (UNIT S) ...)}]
Semantics:S(E0("GLOBAL),E,F,C) = l ...