Page Numbers: Yes X: 310 Y: 10.42" First Page: 1
Margins: Top: 1.0" Bottom: 1.5"
Heading:
3-LISP WORKING GUIDE#16: ALTERNATE REFLECTIVE PROCESSORS
———————————————————————————————————————————
Issue #16:Alternate Reflective Processors
Description:The current reflective processor provides 3 arguments to a reflective procedure: ARGS, ENV, and CONT. We explore processors that provide just ARGS and ENV, in ways that can be coherently integrated with the more powerful approach.
Status:Pure exploration for the time being.
Last Edited:February 8, 1983 (Jim des Rivières)
———————————————————————————————————————————
...
No continuations:
(define READ-NORMALISE-PRINT-2
(lambda simple [level env stream]
(block (prompt&reply (normalise-2 (prompt&read level stream) env)
level
stream)
(read-normalise-print-2 level env stream))))
(define NORMALISE-2
(lambda simple [exp env]
(cond [(normal exp) exp]
[(atom exp) (binding exp env)]
[(rail exp) (normalise-rail-2 exp env)]
[(pair exp) (reduce-2 (car exp) (cdr exp) env)])))
(define REDUCE-2
(lambda simple [proc args env]
(let [[proc! (normalise-2 proc env)]]
(if (reflective-2 proc!)
((de-reflect proc!) args env)
(let [[args! (normalise-2 args env]]
(if (primitive proc!)
↑(proc! . args!)
(normalise-2 (body proc!)
(bind (pattern proc!) args! (environment proc!)))))))))
(define NORMALISE-RAIL-2
(lambda simple [rail env]
(if (empty rail)
(rcons)
(prep (normalise-2 (1st rail) env)
(normalise-rail-2 (rest rail) env)))))
This would engender the following sorts of behaviour:
(+ 2 3)g5
((lambda reflect [? env] ’3))g3
(let [[three (lambda reflect [[] ’3)]]
(+ 2 (three)))g5
(define current-env (lambda reflect [[] env] ↑env))
An amalgam that combines this 2-reflection with standard 3-reflection:
(define READ-NORMALISE-PRINT-23 as in standard 3-LISP)
(define NORMALISE-23 as in standard 3-LISP)
(define REDUCE-23
(lambda simple [proc args env cont]
(normalise proc env
(lambda simple [proc!]; Continuation CPROC!
(cond [(reflective-2 proc!)
((lambda reflect [[] e2 c2]
(c2 (reduce-23 (de-reflect proc!) ↑[args env] e2 cont))))]
;;;
;;;
simpler: (cont ((de-reflect proc!) args env)]
;;;
[(reflective-3 proc!)
((de-reflect proc!) args env cont)]
[$T (normalise args env
(lambda simple [args!]; Continuation CARGS!
(if (primitive proc!)
(cont ↑(proc! . args!))
(normalise (body proc!)
(bind (pattern proc!) args! (environment proc!))
cont))))])))))
(define NORMALISE-RAIL as in standard 3-LISP)
A simpler amalgam that combines this 2-reflection with standard 3-reflection:
(define READ-NORMALISE-PRINT-23 as in standard 3-LISP)
(define NORMALISE-23 as in standard 3-LISP)
(define REDUCE-23
(lambda simple [proc args env cont]
(normalise proc env
(lambda simple [proc!]
(cond [(reflective-2 proc!)
(cont (normalise-2 (body proc!)
(bind (pattern proc!) ↑[args env] (environment proc!))))]
[(reflective-3 proc!)
((de-reflect proc!) args env cont)]
[$T (normalise args env
(lambda simple [args!]
(if (primitive proc!)
(cont ↑(proc! . args!))
(normalise (body proc!)
(bind (pattern proc!) args! (environment proc!))
cont))))])))))
(define NORMALISE-RAIL as in standard 3-LISP)
The original:
(define READ-NORMALISE-PRINT
(lambda simple [level env stream]
(normalise (prompt&read level stream) env
(lambda simple [answer!]
(block (prompt&reply answer! level stream)
(read-normalise-print level env stream))))))
(define NORMALISE
(lambda simple [exp env cont]
(cond [(normal exp) (cont exp)]
[(atom exp) (cont (binding exp env))]
[(rail exp) (normalise-rail exp env cont)]
[(pair exp) (reduce (car exp) (cdr exp) env cont)])))
(define REDUCE
(lambda simple [proc args env cont]
(normalise proc env
(lambda simple [proc!]; Continuation CPROC!
(if (reflective proc!)
((de-reflect proc!) args env cont)
(normalise args env
(lambda simple [args!]; Continuation CARGS!
(if (primitive proc!)
(cont ↑(proc! . args!))
(normalise (body proc!)
(bind (pattern proc!)
args!
(environment proc!))
cont)))))))))
(define NORMALISE-RAIL
(lambda simple [rail env cont]
(if (empty rail)
(cont (rcons))
(normalise (1st rail) env
(lambda simple [first!]; Continuation CFIRST!
(normalise-rail (rest rail) env
(lambda simple [rest!]; Continuation CREST!
(cont (prep first! rest!)))))))))
First paragraph
Regular paragraph

1. <SECTION TITLE>
First paragraph in a section
Regular paragraph in a section
---1--2--3--4--5--6--7--8--9--A--B--C--D
0CODE with tabs every 3 columns.
1CODE
2CODE
3CODE
CODE; This is a comment(S1)
CODE; This is a comment(S11)
CODE; This is a comment(S111)
Continuation paragraph
Font and Face samples:
Proper Names: 3-LISP, INTERLISP, FORTRAN, etc. (i.e., font 7 in regular text). Generally, use 1 pt size smaller than running text. (Fonts 1, 7, 0, 9, and 5 are, respectively, TimesRoman 8, 9, 10, 11, and 12). Also XEROX PARC.
Category Names: STRUCTURES, RAILS, SEQUENCES, etc. — bold italic gacha 10 (font 3) for meta-theoretical names of the domain categories.
Code: Gacha for now (font 3). Meta-theoretic variables in code are sometimes simply italic (i.e. (RCONS X Y)). Elipsis is font 0 (i.e. (+ A1 A2 ... Ak), not (+ A1 A2 ... Ak)).
Footnotes: Reference to,2 and body of footnote is 1 pt smaller: generally font 7 (TimesRoman 9).
Subscripts and Superscripts: Font 6 (gacha 8), with an up of 4 pts and a down of 2 pts for super and subscripts, respectively (default is 2; therefore superscripts have to be set explicitly). I.e., A1, A2, ... Ak, or F1(A).
Meta-Language: Mixture of Math (font 4), Greek (font 2), and Gacha (font 3).
Definitions: When a technical term is defined, it should be underlined bold italic.