xref: /original-bsd/old/lisp/fp/PSD.doc/manApp.rno (revision 241757c4)
Copyright (c) 1980 Regents of the University of California.
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.

@(#)manApp.rno 6.2 (Berkeley) 05/10/86

.sx 0 .AP "Appendix A: Local Modifications" .NS 1 "Character Set Changes" .pp Backus [Ba78] used some characters that do not appear on our ASCII terminals, so we have made the following substitutions:
constant $x bar$ %x
insert \(sl !
apply-to-all \(*a &
composition \*(cm @
arrow $->$ ->
empty set \(*f <>
bottom \*(bt ?
divide \(di \(sl
multiply \(mu \(**
.NS 1 "Syntactic Modifications" .NS 2 "While and Conditional" .pp While and conditional functional expressions must be enclosed in parenthesis, \*(EG .(c (while f g) (p -> f ; g) .)c .NS 2 "Function Definitions" .pp Function definitions are enclosed by curly braces; they consist of a name-definition pair, separated by blanks. For example:

1 .b "{fact$~$ !\(** @ iota}" defines the function fact (the reader should recognize this as the non-recursive factorial function). .NS 2 "Sequence Construction" .pp It is not necessary to separate elements of a sequences with a comma; a blank will suffice:

1 <1,2,3> $==$ <1 2 3>

.pp For nested sequences, the terminating right angle bracket acts as the delimiter:

1 <<1,2,3>,<4,5,6>> $==$ <<1 2 3><4 5 6>>

.NS 1 "User Interface" .pp We have provided a rich set of commands that allow the user to catalog, print, and delete functions, to load them from a file and to save them away. The user may generate script files, dynamically trace and measure functional expression execution, generate debugging output, and, temporarily exit to the \s-2FRANZ LISP\s+2 system. A command must begin with a right parenthesis. Consult Appendix C for a complete description of the command syntax. .pp Debugging in FP is difficult; all undefined results map to a single atom - bottom (\*(lq?\*(rq). To pinpoint the cause of an error the user can use the special debugging output function, out, or the tracer. .NS 1 "Additions and Ommissions" .pp Many relational functions have been added: $<,~~>,~~=,~~ \(!=, ~~<=,~~>=$; their syntax is: <, >, =, ~=, <=, >=. Also added are the iota function (This is the \s-2APL\s+2 iota function an n-element sequence of natural numbers) and the exclusive OR (\z\(ci\(pl) function. .pp Several new structural functions have been added: pair pairs up successive elements of a sequence, split splits a sequence into two (roughly) equal halves, last returns the last element of the sequence (<> if the sequence is empty), first returns the first element of the sequence (<> if it is empty), and concat concatenates all subsequences of a sequence, squeezing out null sequences (<>). Front is equivalent to tlr. Pick is a parameterized form of the selector function; the first component of the argument selects a single element from the second component. Out is the only side-effect function; it is equivalent to the id function but it also prints its argument out at the terminal. This function is intended to be used only for debugging. .pp One new functional form has been added, tree insert. This functional form breaks up the the argument into two roughly equal pieces applying itself recursively to the two halves. The functional parameter is applied to the result. .pp The binary-to-unary functions ('bu') has been omitted. .pp Seven mathematical library functions have been added: sin, cos, asin ($sin sup {-1}$), acos ($cos sup {-1}$), log, exp, and mod (the remainder function) .bp .sx
.nr ii 18
.AP "Appendix B: FP Grammar"
I. BNF Syntax
.ip "fpInput $->$"
(fnDef | application | fpCmd\*(sa)\(** | '^D'
.ip "fnDef $->$"
'{' name funForm '}'
.ip "application $->$"
funForm ':' object
.ip "name $->$"
letter (letter | digit | '_')\(**
.ip "nameList $->$"
(name)\(**
.ip "object $->$"
atom | fpSequence | '?'
.ip "fpSequence $->$"
'<' (\(*e | object ((',' | ' ') object)\(**) '>'
.ip "atom $->$"
'T' | 'F' | '<>' | '"' (ascii-char)\(** '"' | (letter | digit)\(** | number
.ip "funForm $->$"
simpFn | composition | construction | conditional |

constantFn | insertion | alpha | while | '(' funForm ')' .ip "simpFn $->$" fpDefined | fpBuiltin .ip "fpDefined $->$" name .ip "fpBuiltin $->$" selectFn | 'tl' | 'id' | 'atom' | 'not' | 'eq' | relFn | 'null' | 'reverse' |

'distl' | 'distr' | 'length' | binaryFn | 'trans' | 'apndl' | 'apndr' |

'tlr' | 'rotl' | 'rotr' | 'iota' | 'pair' | 'split' | 'concat' | 'last' | 'libFn' .ip "selectFn $->$" (\(*e | '+' | '-') unsignedInteger .ip "relFn $->$" '<=' | '<' | '=' | '~=' | '>' | '>=' .ip "binaryFn $->$" '+' | '-' | '\(**' | '/' | 'or' | 'and' | 'xor' .ip "libFn $->$" 'sin' | 'cos' | 'asin' | 'acos' | 'log' | 'exp' | 'mod' .ip "composition $->$" funForm '@' funForm .ip "construction $->$" '[' formList ']' .ip "formList $->$" \(*e | funForm (',' funForm)\(** .ip "conditional $->$" '(' funForm '->' funForm ';' funForm ')' .ip "constantFn $->$" '%' object .ip "insertion $->$" '!' funForm | '|' funForm .ip "alpha $->$" '&' funForm .ip "while $->$" '(' 'while' funForm funForm ')' .lp

II. Precedences
1. %, !, & (highest)
2. @
3. [$...$]
4. -> $...$ ; $...$
5. while (least)
.(q
\*(sa Command Syntax is listed in Appendix C.
.)q
.AP "Appendix C: Command Syntax" .pp All commands begin with a right parenthesis (\*(lq)\*(rq).
)fns
)pfn <nameList>
)load <UNIX file name>
)cload <UNIX file name>
)save <UNIX file name>
)csave <UNIX file name>
)fsave <UNIX file name>
)delete <nameList>
)stats on
)stats off
)stats reset
)stats print [UNIX file name]
)trace on <nameList>
)trace off <nameList>
)timer on
)timer off
)debug on
)debug off
)script open <UNIX file name>
)script close
)script append <UNIX file name>
)help
)lisp
delim `'
.EN
.AP "Appendix D: Token-Name Correspondences"
Token Name
[ lbrack$$
] rbrack$$
{ lbrace$$
} rbrace$$
( lparen$$
) rparen$$
@ compos$$
! insert$$
\fB| ti$$
& alpha$$
; semi$$
: colon$$
, comma$$
+ builtin$$
+ `mu sup a' select$$
\(** builtin$$
/ builtin$$
= builtin$$
- builtin$$
-> arrow$$
- `mu' select$$
> builtin$$
>= builtin$$
< builtin$$
<= builtin$$
~= builtin$$
%`omicron sup b' constant$$
.(q \*(sa \(*m is an optionally signed integer constant. \*(sb \(*o is any FP object. .)q .AP "Appendix E: Symbolic Primitive Function Names" .pp The scanner assigns names to the alphabetic primitive functions by appending the string \*(lq$fp\*(rq to the end of the function name. The following table designates the naming assignments to the non-alphabetic primitive function names.
Function Name
+ plus$fp
- minus$fp
\(** times$fp
/ div$fp
= eq$fp
> gt$fp
>= ge$fp
< lt$fp
<= le$fp
~= ne$fp
want Table of Contents to begin on page 2
.TC