Page Numbers: Yes X: 310 Y: 10.42" First Page: 1
Margins: Top: 1.0" Bottom: 1.5"
Heading:
3-LISP WORKING GUIDE#14: Multiple results
———————————————————————————————————————————
Issue #14:Multiple results
Description:Should the reflective processor be designed so that expressions can normalize to zero, one, or more results?
Status:Unresolved
Last Edited:September 20, 1982 (Jim des Rivières)
———————————————————————————————————————————
Here’s a reflective processor that I was doodling with...
1> (define NORMALIZE
(lambda simple [exp env esc cont]
(cond [(normal exp) (cont exp)]
[(atom exp) (binding exp env esc cont)]; BINDING does (cont x)
[(pair exp) (reduce (car exp) (cdr exp) env esc cont)]
[(rail exp) (normalize-rail exp env esc cont)])))
1> (define NORMALIZE-RAIL
(lambda simple [rail env esc cont]
(if (empty rail)
(cont (rcons))
(normalize (first rail) env esc
(lambda simple [element!]
(normalize-rail (rest rail) env esc
(lambda simple [rest!]
(cont (prep element! rest!)))))))))
1> (define REDUCE
(lambda simple [proc args env esc cont]
(normalize args env esc
(lambda simple [proc!]
(selectq (procedure-type proc!)
[reflect (\(de-reflect proc!) args env esc cont)]
[simple
(normailize args env esc
(lambda simple [args!]
(if (primitive proc!)
(error-protect (\proc! . \args!)
(lambda simple results!
(cont . (map up results!)))
esc)
<...>)))])))))
1> (define ERROR-PROTECT
(lambda reflect [args env esc cont]
(normalize (first args) env
(lambda simple error-args
(reduce (third args) ↑error-args env esc cont))
(lambda simple results
(reduce (second args) (rcons . results) env esc cont)))))
1. <SECTION TITLE>
First paragraph in a section
Regular paragraph in a section
...
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.