|
|
1.1 root 1: .\" Copyright (c) 1980 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)manApp.rno 6.2 (Berkeley) 5/10/86
6: .\"
7: .sx 0
8: .AP "Appendix A: Local Modifications"
9: .NS 1 "Character Set Changes"
10: .sp
11: .pp
12: Backus [Ba78] used some
13: characters that do not appear on our
14: ASCII terminals, so we have made the following substitutions:
15: .sp 2
16: .TS
17: center box;
18: l|c|c.
19: \fBconstant\fP $x bar$ %\fIx\fP
20: \fBinsert\fP \(sl !
21: \fBapply-to-all\fP \(*a &
22: \fBcomposition\fP \*(cm @
23: \fBarrow\fP $->$ ->
24: \fBempty set\fP \(*f <>
25: \fBbottom\fP \*(bt ?
26: \fBdivide\fP \(di \(sl
27: \fBmultiply\fP \(mu \(**
28: .TE
29: .sp
30: .NS 1 "Syntactic Modifications"
31: .NS 2 "While and Conditional"
32: .pp
33: \fBWhile\fP and conditional functional expressions
34: \fImust\fP be enclosed in parenthesis, \*(EG
35: .sp
36: .(c
37: (\fBwhile\fP \fIf g\fP)
38: .sp
39: (\fIp\fP \fB->\fP \fIf\fP \fB;\fP \fIg\fP)
40: .)c
41: .sp
42: .NS 2 "Function Definitions"
43: .pp
44: Function definitions are
45: enclosed by curly braces; they
46: consist of a name-definition pair,
47: separated by blanks. For example:
48: .sp
49: .ce 1
50: .b "{fact$~$ !\(** @ iota}"
51: .sp
52: defines the function \fBfact\fP (the reader should recognize this as the
53: non-recursive factorial function).
54: .sp
55: .NS 2 "Sequence Construction"
56: .pp
57: It is not necessary to separate elements of a sequences with
58: a comma; a blank will suffice:
59: .sp
60: .nf
61: .ce 1
62: <1,2,3> $==$ <1 2 3>
63: .sp
64: .fi
65: .pp
66: For nested sequences, the terminating right angle bracket
67: acts as the delimiter:
68: .sp
69: .nf
70: .ce 1
71: <<1,2,3>,<4,5,6>> $==$ <<1 2 3><4 5 6>>
72: .sp
73: .fi
74: .sp 2
75: .NS 1 "User Interface"
76: .sp
77: .pp
78: We have provided a rich set of commands that allow the user to
79: catalog, print, and
80: delete functions, to load them from a file and to save them away.
81: The user may generate script files, dynamically trace and
82: measure functional expression execution, generate debugging output,
83: and, temporarily exit to the \s-2FRANZ LISP\s+2 system.
84: A command must begin with a right parenthesis.
85: Consult Appendix C for a complete description of the command syntax.
86: .pp
87: Debugging in FP is difficult;
88: all undefined results map to a single
89: atom \- \fIbottom\fP (\*(lq?\*(rq).
90: To pinpoint the cause of an error the user can use
91: the special debugging output function, \fBout\fP, or the tracer.
92: .sp
93: .NS 1 "Additions and Ommissions"
94: .sp
95: .pp
96: Many relational functions have been added: $<,~~>,~~=,~~ \(!=, ~~<=,~~>=$;
97: their
98: syntax is: <, >, =, ~=, <=, >=.
99: Also added are the \fBiota\fP function (This is the \s-2APL\s+2
100: iota function
101: an n-element sequence
102: of natural numbers) and the exclusive OR (\z\(ci\(pl) function.
103: .pp
104: Several new structural functions have been added: \fBpair\fP
105: pairs up successive elements of a sequence, \fBsplit\fP splits
106: a sequence into two (roughly) equal halves, \fBlast\fP returns
107: the last element of the sequence (<> if the sequence is empty),
108: \fBfirst\fP returns the first element of the sequence
109: (<> if it is empty), and \fBconcat\fP
110: concatenates all subsequences of a sequence, squeezing out null sequences (<>).
111: \fBFront\fP is equivalent to \fBtlr\fP.
112: \fBPick\fP is a parameterized form of
113: the selector function; the first component of the argument selects
114: a single element from the second component.
115: \fBOut\fP is the only side-effect function; it is equivalent
116: to the \fBid\fP function but it also prints its argument out at the
117: terminal. This function is intended to be used only for debugging.
118: .pp
119: One new functional form has been added, tree insert. This
120: functional form breaks up the the argument into two roughly equal pieces
121: applying itself
122: recursively to the two halves. The functional parameter is applied to the
123: result.
124: .pp
125: The binary-to-unary functions ('\fBbu\fP') has been omitted.
126: .pp
127: Seven mathematical library functions have been added: sin, cos, asin
128: ($sin sup {-1}$), acos ($cos sup {-1}$), log, exp, and mod (the
129: remainder function)
130: .bp
131: .sx
132: .nf
133: .nr ii 18
134: .AP "Appendix B: FP Grammar"
135: \fII. BNF Syntax\fP
136: .sp
137: .ip "fpInput $->$"
138: (fnDef | application | fpCmd\*(sa)\(** | '^D'
139: .ip "fnDef $->$"
140: \&'{' name funForm '}'
141: .ip "application $->$"
142: funForm ':' object
143: .ip "name $->$"
144: letter (letter | digit | '_')\(**
145: .ip "nameList $->$"
146: (name)\(**
147: .ip "object $->$"
148: atom | fpSequence | '?'
149: .ip "fpSequence $->$"
150: \&'<' (\(*e | object ((',' | ' ') object)\(**) '>'
151: .ip "atom $->$"
152: \&'T' | 'F' | '<>' | '"' (ascii-char)\(** '"' | (letter | digit)\(** | number
153: .ip "funForm $->$"
154: simpFn | composition | construction | conditional |
155: .br
156: constantFn | insertion | alpha | while | '(' funForm ')'
157: .ip "simpFn $->$"
158: fpDefined | fpBuiltin
159: .ip "fpDefined $->$"
160: name
161: .ip "fpBuiltin $->$"
162: selectFn | 'tl' | 'id' | 'atom' | 'not' | 'eq' | relFn | 'null' | 'reverse' |
163: .br
164: \&'distl' | 'distr' | 'length' | binaryFn | 'trans' | 'apndl' | 'apndr' |
165: .br
166: \&'tlr' | 'rotl' | 'rotr' | 'iota' | 'pair' | 'split' | 'concat' | 'last' | 'libFn'
167: .ip "selectFn $->$"
168: (\(*e | '+' | '-') unsignedInteger
169: .ip "relFn $->$"
170: \&'<=' | '<' | '=' | '~=' | '>' | '>='
171: .ip "binaryFn $->$"
172: \&'+' | '-' | '\(**' | '/' | 'or' | 'and' | 'xor'
173: .ip "libFn $->$"
174: \&'sin' | 'cos' | 'asin' | 'acos' | 'log' | 'exp' | 'mod'
175: .ip "composition $->$"
176: funForm '@' funForm
177: .ip "construction $->$"
178: \&'[' formList ']'
179: .ip "formList $->$"
180: \(*e | funForm (',' funForm)\(**
181: .ip "conditional $->$"
182: \&'(' funForm '->' funForm ';' funForm ')'
183: .ip "constantFn $->$"
184: \&'%' object
185: .ip "insertion $->$"
186: \&'!' funForm | '\fB|\fP' funForm
187: .ip "alpha $->$"
188: \&'&' funForm
189: .ip "while $->$"
190: \&'(' 'while' funForm funForm ')'
191: .sp
192: .lp
193: .nf
194: \fIII. Precedences\fP
195: .sp
196: 1. %, !, & (highest)
197: 2. @
198: 3. [$...$]
199: 4. -> $...$ ; $...$
200: 5. while (least)
201: .(q
202: .sp 2
203: \*(sa Command Syntax is listed in Appendix C.
204: .)q
205: .fi
206: .AP "Appendix C: Command Syntax"
207: .pp
208: All commands begin with a right parenthesis (\*(lq)\*(rq).
209: .sp 2
210: .nf
211: )fns
212: )pfn <nameList>
213: )load <UNIX file name>
214: )cload <UNIX file name>
215: )save <UNIX file name>
216: )csave <UNIX file name>
217: )fsave <UNIX file name>
218: )delete <nameList>
219: )stats on
220: )stats off
221: )stats reset
222: )stats print [UNIX file name]
223: )trace on <nameList>
224: )trace off <nameList>
225: )timer on
226: )timer off
227: )debug on
228: )debug off
229: )script open <UNIX file name>
230: )script close
231: )script append <UNIX file name>
232: )help
233: )lisp
234: .EQ
235: delim `'
236: .EN
237: .AP "Appendix D: Token-Name Correspondences"
238: .TS
239: center box;
240: c|c
241: c|l.
242: Token Name
243: =
244: \&[ lbrack$$
245: \&] rbrack$$
246: \&{ lbrace$$
247: \&} rbrace$$
248: \&( lparen$$
249: \&) rparen$$
250: \&@ compos$$
251: \&! insert$$
252: \&\fB|\fP ti$$
253: \&& alpha$$
254: \&; semi$$
255: \&: colon$$
256: \&, comma$$
257: \&+ builtin$$
258: \&+ `mu sup a' select$$
259: \&\(** builtin$$
260: \&/ builtin$$
261: \&= builtin$$
262: \&- builtin$$
263: \&-> arrow$$
264: \&- `mu' select$$
265: \&> builtin$$
266: \&>= builtin$$
267: \&< builtin$$
268: \&<= builtin$$
269: \&~= builtin$$
270: \&%`omicron sup b' constant$$
271: .TE
272: .sp 2
273: .(q
274: \*(sa \(*m is an optionally signed integer constant.
275: .sp
276: \*(sb \(*o is any FP object.
277: .)q
278: .AP "Appendix E: Symbolic Primitive Function Names"
279: .pp
280: The scanner assigns names to the alphabetic primitive functions by
281: appending the string \*(lq$fp\*(rq to the end of the function name.
282: The following table designates the
283: naming assignments to the non-alphabetic primitive function names.
284: .sp
285: .TS
286: center box;
287: c|c
288: c|l.
289: Function Name
290: =
291: \&+ plus$fp
292: \&- minus$fp
293: \&\(** times$fp
294: \&/ div$fp
295: \&= eq$fp
296: \&> gt$fp
297: \&>= ge$fp
298: \&< lt$fp
299: \&<= le$fp
300: \&~= ne$fp
301: .TE
302: .\" want Table of Contents to begin on page 2
303: .pn 2
304: .TC
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.