diff --git a/doc/lisp1.5.md b/doc/lisp1.5.md
index c187ba4..d554bcf 100644
--- a/doc/lisp1.5.md
+++ b/doc/lisp1.5.md
@@ -14,59 +14,40 @@
> Massachusetts Institute of Technology
> Cambridge, Massachusetts
-The Research Laboratory af Electronics is an interdepartmental
-laboratory in which faculty members and graduate students from
-numerous academic departments conduct research.
+The Research Laboratory af Electronics is an interdepartmental laboratory in which faculty members and graduate students from numerous academic departments conduct research.
-The research reported in this document was made possible in part
-by support extended the Massachusetts Institute of Technology, Re-
-search Laboratory of Electronics, jointly by the U.S. Army, the
-U.S. Navy (Office of Naval Research), and the U.S. Air Force
-(Office of Scientific Research) under Contract DA36-039-sc-78108,
-Department of the Army Task 3-99-25-001-08; and in part by Con-
-tract DA-SIG-36-039-61-G14; additional support was received from
-the National Science Foundation (Grant G-16526) and the National
-Institutes of Health (Grant MH-04737-02).
+The research reported in this document was made possible in part by support extended the Massachusetts Institute of Technology, Research Laboratory of Electronics, jointly by the U.S. Army, the U.S. Navy (Office of Naval Research), and the U.S. Air Force (Office of Scientific Research) under Contract DA36-039-sc-78108, Department of the Army Task 3-99-25-001-08; and in part by Contract DA-SIG-36-039-61-G14; additional support was received from the National Science Foundation (Grant G-16526) and the National Institutes of Health (Grant MH-04737-02).
-Reproduction in whole or in part is permitted for any purpose
-of the United States Government.
+Reproduction in whole or in part is permitted for any purpose of the United States Government.
SECOND EDITION Fifteenth printing, 1985
ISBN 0 262 130 1 1 4 (paperback)
+-----
+
#### Note regarding this Markdown document
-This Markdown version of the manual was created by me,
-[Simon Brooke](mailto:simon@journeyman.cc), by passing the PDF
-version found at [Software Preservation](https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf) through a [PDF to
-Markdown processor](https://pdf2md.morethan.io/), and hand-editing
-the resulting document.
+This Markdown version of the manual was created by me, [Simon Brooke](mailto:simon@journeyman.cc), by passing the PDF version found at [Software Preservation](https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf) through a [PDF to
+Markdown processor](https://pdf2md.morethan.io/), and hand-editing the resulting document.
-**This document is not authorised by the copyright holders.** It was
-made for the purposes of study, only.
+**This document is not authorised by the copyright holders.** It was made for the purposes of study, only.
-Notes which I have added during editing are *NOTE: given in italics, like this*.
+Generally I have tried to keep the text unaltered. Some minor headings, especially of examples, have been deliberately changed in order to aid navigation, and some apparent typographic errors have been corrected. *I have also added spaces between syntactic elements in M-expression examples to aid legibility.* Page numbers are taken from the original. Notes which I have added during editing are *NOTE: given in italics, like this*.
+
+-----
## PREFACE
-The over-all design of the LISP Programming System is the work of John McCarthy
-and is based on his paper NRecursive Functions of Symbolic Expressions and Their Com-
-putation by Machinett which was published in Communications of the ACM, April 1960.
+The over-all design of the LISP Programming System is the work of John McCarthy and is based on his paper "[Recursive Functions of Symbolic Expressions and Their Computation by Machine](http://www-formal.stanford.edu/jmc/recursive/recursive.html)" which was published in Communications of the ACM, April 1960.
+
This manual was written by Michael I. Levin.
-The interpreter was programmed by Stephen B. Russell and Daniel J. Edwards.
-The print and read programs were written by John McCarthy, Klim Maling,
-Daniel J. Edwards, and Paul W, Abrahams.
+The interpreter was programmed by Stephen B. Russell and Daniel J. Edwards. The print and read programs were written by John McCarthy, Klim Maling, Daniel J. Edwards, and Paul W, Abrahams.
-The garbage collector and arithmetic features Were written by Daniel J. Edwards.
-The compiler and assembler were written by Timothy P. Hart and Michael I. Levin.
-An earlier compiler was written by Robert Brayton.
+The garbage collector and arithmetic features Were written by Daniel J. Edwards. The compiler and assembler were written by Timothy P. Hart and Michael I. Levin. An earlier compiler was written by Robert Brayton.
-The "LISP 1 Programmer's Manual" March 1, 1960, was written by Phyllis A. Fox.
-Additional programs and suggestions were contributed by the following members of the Artificial Intelligence Group of the Research Laboratory of Electronics:
-Marvin L. Minsky, Bertram Raphael, Louis Hodes, David M. R. Park, David C. Luckham,
-Daniel G. Bobrow, James R. Slagle, and Nathaniel Rochester.
+The "LISP 1 Programmer's Manual" March 1, 1960, was written by Phyllis A. Fox. Additional programs and suggestions were contributed by the following members of the Artificial Intelligence Group of the Research Laboratory of Electronics: Marvin L. Minsky, Bertram Raphael, Louis Hodes, David M. R. Park, David C. Luckham, Daniel G. Bobrow, James R. Slagle, and Nathaniel Rochester.
August 17, 1962
@@ -128,39 +109,21 @@ I. LISP for SHARE Distribution
## I. THE LISP LANGUAGE
-The LISP language is designed primarily for symbolic data processing. It has been
-used for symbolic calculations in differential and integral calculus, electrical circuit
-theory, mathematical logic, game playing, and other fields of artificial intelligence.
-LISP is a formal mathematical language. It is therefore podsible to give a con-
-cise yet complete description of it. Such is the purpose of this first section of the
-manual. Other sections will describe ways of using LISP to advantage and will explain
-extensions of the language which make it a convenient programming system.
+The LISP language is designed primarily for symbolic data processing. It has been used for symbolic calculations in differential and integral calculus, electrical circuit theory, mathematical logic, game playing, and other fields of artificial intelligence.
-LISP differs from most programming languages in three important ways. The
-first way is in the nature of the data. In the LISP language, all data are in the form
-of symbolic expressions usually referred to as S-expressions. S-expressions are of
-indefinite length and have a branching tree type of structure, so that significant sub-
-expressions can be readily isolated. In the LISP programming system, the bulk of
-available memory is used for storing S-expressions in the form of list structures.
-This type of memory organization frees the programmer from the necessity of
-allocating storage for the different sections of his program.
+LISP is a formal mathematical language. It is therefore possible to give a concise yet complete description of it. Such is the purpose of this first section of the manual. Other sections will describe ways of using LISP to advantage and will explain extensions of the language which make it a convenient programming system.
-The second important part of the LISP language is the source language itself which
-specifies in what way the S-expressions are to be processed. This consists of recur-
-sive functions of S-expressions. Since the notation for the writing of recursive func-
-tions of S-expressions is itself outside the S-expression notation, it will be called the
-meta language. These expressions will therefore be called M-expressions.
+LISP differs from most programming languages in three important ways. The first way is in the nature of the data. In the LISP language, all data are in the form of symbolic expressions usually referred to as S-expressions. S-expressions are of indefinite length and have a branching tree type of structure, so that significant sub-expressions can be readily isolated. In the LISP programming system, the bulk of available memory is used for storing S-expressions in the form of list structures. This type of memory organization frees the programmer from the necessity of allocating storage for the different sections of his program.
-Third, LISP can interpret and execute programs written in the form of S-
-expressions. Thus, like machine language, and unlike most other higher level languages,
-it can be used to generate programs for further execution.
+The second important part of the LISP language is the source language itself which specifies in what way the S-expressions are to be processed. This consists of recursive functions of S-expressions. Since the notation for the writing of recursive functions of S-expressions is itself outside the S-expression notation, it will be called the meta language. These expressions will therefore be called M-expressions.
+
+Third, LISP can interpret and execute programs written in the form of S-expressions. Thus, like machine language, and unlike most other higher level languages, it can be used to generate programs for further execution.
### 1.1 Symbolic Expressions
The most elementary type of S-expression is the atomic symbol.
-**Definition**: An atomic symbol is a string of no more than thirty numerals and capital
-letters; the first character must be a letter.
+**Definition**: An atomic symbol is a string of no more than thirty numerals and capital letters; the first character must be a letter.
#### Examples - atomic symbols
@@ -170,22 +133,15 @@ letters; the first character must be a letter.
* EXTRALONGSTRINGOFLETTERS
* A4B66XYZ
-These symbols are called atomic because they are taken as a whole and are not
-capable of being split within LISP into individual characters, Thus A, B, and AB
-have no relation to each other except in so far as they are three distinct atomic
-symbols.
+These symbols are called atomic because they are taken as a whole and are not capable of being split within LISP into individual characters, Thus A, B, and AB have no relation to each other except in so far as they are three distinct atomic symbols.
All S-expressions are built out of atomic symbols and the punctuation marks
page 2
-`(` `)` and `.`. The basic operation for forming S-expressions is to combine two
-of them to produce a larger one. From the two atomic symbols A1 and A2, one can
-form the S-expression `(A1 . A2)`.
+`(` `)` and `.`. The basic operation for forming S-expressions is to combine two of them to produce a larger one. From the two atomic symbols A1 and A2, one can form the S-expression `(A1 . A2)`.
-**Definition**: An S-expression is either an atomic symbol or it is composed of these
-elements in the following order: a left parenthesis, an S-expression, a dot, an S-
-expression, and a right parenthesis.
+**Definition**: An S-expression is either an atomic symbol or it is composed of these elements in the following order: a left parenthesis, an S-expression, a dot, an S-expression, and a right parenthesis.
Notice that this definition is recursive.
@@ -200,14 +156,9 @@ Notice that this definition is recursive.
### 1.2 Elementary Functions
-We shall introduce some elementary functions of S-expressions. To distinguish
-the functions from the S-expressions themselves, we shall write function names in
-lower case letters, since atomic symbols consist of only upper case letters. Furthermore,
-the arguments of functions will be grouped in square brackets rather than
-parentheses. As a separator or punctuation mark we shall use the semicolon.
+We shall introduce some elementary functions of S-expressions. To distinguish the functions from the S-expressions themselves, we shall write function names in lower case letters, since atomic symbols consist of only upper case letters. Furthermore, the arguments of functions will be grouped in square brackets rather than parentheses. As a separator or punctuation mark we shall use the semicolon.
-The first function that we shall introduce is the function `cons`. It has two arguments
-and is in fact the function that is used to build S-expressions from smaller S-expressions.
+The first function that we shall introduce is the function `cons`. It has two arguments and is in fact the function that is used to build S-expressions from smaller S-expressions.
#### Examples - the cons function
@@ -217,13 +168,11 @@ cons[(A . B); C] = ((A . B) . C)
cons[cons[A; B]; C] = ((A . B) . C)
```
-The last example is an instance of composition of functions. It is possible to build
-any S-expression from its atomic components by compositions of the function cons.
-The next pair of functions do just the opposite of cons. They produce the subexpres-
-sions of a given expression.
+The last example is an instance of composition of functions. It is possible to build any S-expression from its atomic components by compositions of the function cons. The next pair of functions do just the opposite of cons. They produce the subexpressions of a given expression.
-The function `car` has one argument. Its value is the first part of its composite
-argument. `car` of an atomic symbol is undefined.
+The function `car` has one argument. Its value is the first part of its composite argument. `car` of an atomic symbol is undefined.
+
+*Note that where this says 'car of an atomic symbol is undefined', it seems to mean it literally. There seems to have been no mechanism for distinguishing cons cells from other items in memory, so that the car of, for example, a decimal number could be taken, although the result
#### Examples - the car function
@@ -284,13 +233,14 @@ eq[A; A] = T
eq[A; B] = F
eq[A; (A . B)] is undefined
eq[(A . B);(A . B)] is undefined
+```
The predicate `atom` is true if its argument is an atomic symbol, and false if its
argument is composite.
#### Examples - atom
-````
+```
atom[EXTRALONGSTRINGOFLETTERS] = T
atom[(u . v)] = F
atom[car[(u . v)]] = T
@@ -300,25 +250,17 @@ atom[car[(u . v)]] = T
### 1.3 List Notation
-The S-expressions that have been used heretofore have been written in dot notation.
-It is usually more convenient to be able to write lists of expressions of indefinite length,
-such as `(A B C D E)`.
+The S-expressions that have been used heretofore have been written in dot notation. It is usually more convenient to be able to write lists of expressions of indefinite length, such as `(A B C D E)`.
-Any S-expression can be expressed in terms of the dot notation. However, LISP has an
-alternative form of S-expression called the list notation. The list `(m1 m2... mn)` can be
-defined in terms of dot notation. It is identical to `(m1 . (m2 . (... . (mn . NIL)... )))`.
+Any S-expression can be expressed in terms of the dot notation. However, LISP has an alternative form of S-expression called the list notation. The list `(m1 m2... mn)` can be defined in terms of dot notation. It is identical to `(m1 . (m2 . (... . (mn . NIL)... )))`.
-The atomic symbol NIL serves as a terminator for lists. The null list `()` is iden-
-tical to `NIL`. Lists may have sublists. The dot notation and the list notation may be
-used in the same S-expression,
+The atomic symbol NIL serves as a terminator for lists. The null list `()` is identical to `NIL`. Lists may have sublists. The dot notation and the list notation may be used in the same S-expression,
-Historically, the separator for elements of lists was the comma `(,)`; however, the
-blank is now generally used. The two are entirely equivalent in LISP. `(A, B, C)` is
-identical to `(A B C)`.
+Historically, the separator for elements of lists was the comma `(,)`; however, the blank is now generally used. The two are entirely equivalent in LISP. `(A, B, C)` is identical to `(A B C)`.
#### Examples - list notation
-```
+```lisp
(A B C) = (A . (B . (C . NIL)))
((A B) C) = ((A . (B . NIL)) . (C . NIL))
(A B (C D)) = (A . (B . ((C . (D . NIL)). NIL)))
@@ -327,9 +269,7 @@ identical to `(A B C)`.
(A (B . C)) = (A . ((B . C) . NIL))
```
-It Is important to become familiar with the results of elementary functions on
-S-expressions written in list notation. These can always be determined by translating
-into dot notation.
+It Is important to become familiar with the results of elementary functions on S-expressions written in list notation. These can always be determined by translating into dot notation.
#### Examples - list notation 2
@@ -342,300 +282,296 @@ cdr[(A)] = NIL
car[cdr[(A B C)]] = B
```
-It is convenient to abbreviate multiple `car`s and `cdr`s. This is done by forming
-function names that begin with `c`, end with `r`, and have several `a`s and `d`s between
-them.
+It is convenient to abbreviate multiple `car`s and `cdr`s. This is done by forming function names that begin with `c`, end with `r`, and have several `a`s and `d`s between them.
-### Examples - composed accessor functions
+#### Examples - composed accessor functions
```
cadr[(A B C)] = car[cdr[(A B C)]] = B
-caddr[(A B C )] = C
+caddr[(A B C)] = C
cadadr[(A (B C) D)] = C
```
-The last a or d in the name actually signifies the first operation in order to be
+page 5
+
+The last `a` or `d` in the name actually signifies the first operation in order to be
performed, since it is nearest to the argument.
-1.4 The LISP Meta-language
-We have introduced a type of data called S-expressions, and five elementary func-
-tions of S-expressions. We have also discussed the following features of the meta-
-language.
+### 1.4 The LISP Meta-language
-1. Function names and variable names are like atortlfc symbols except that they
-use lower case letters.
-2. The arguments of a function are bound by square brackets and separated from
-each other by semicolons.
-3. Compositions of functions may be written by using nested sets of brackets.
-These rules allow one to write function definitions such as
-third[x]=car[cdr[cdr[x]]].
+We have introduced a type of data called S-expressions, and five elementary functions of S-expressions. We have also discussed the following features of the meta-language.
-This function selects the third item on a list. For example,
+1. Function names and variable names are like atomic symbols except that they use lower case letters.
+2. The arguments of a function are bound by square brackets and separated from each other by semicolons.
+3. Compositions of functions may be written by using nested sets of brackets. These rules allow one to write function definitions such as `third[x]=car[cdr[cdr[x]]]`.
-third is actually the same function as caddr.
-The class of functions that can be formed in this way is quite limited and hot Very
-interesting. A much larger class of functions can be defined by means of the con-
-ditional expression, a device for providing branches in function definitions.
-A conditional expression has the following form:
+This function selects the third item on a list. For example, `third` is actually the same function as `caddr`.
-```
-where each pi is an expression whose value may be truth or falsity, and each ei is
-any expression. The meaning of a conditional expression is: if pl is true. then the
-value of el is the value of the entire expression. If pl is false, then if p2 is true
-the value of e2 is the value of the entire expression. The pi are searched from left
-to right until the first true one is found. Then the corresponding ei is selected. If
-none of the pi are true, then the value of the entire expression is undefined.
-Each pi or ei can itselk be either an 6-expression, a function, ta composition of
-functions or may it self be another conditional expression.
-Example
-[eq[car[x];~]eons[~ ;cdr[x]]; T-x]
-The atomic symbol T represents truth, The value of this expression is obtained
-if one replaces car of x by B if it happens to be A, but leaving x unchanged if car of
+The class of functions that can be formed in this way is quite limited and not very interesting. A much larger class of functions can be defined by means of the conditional expression, a device for providing branches in function definitions. A conditional expression has the following form:
+
+> where each pi is an expression whose value may be truth or falsity, and each ei is
+> any expression. The meaning of a conditional expression is: if p1 is true. then the
+> value of e1 is the value of the entire expression. If p1 is false, then if p2 is true
+> the value of e2 is the value of the entire expression. The pi are searched from left
+> to right until the first true one is found. Then the corresponding ei is selected. If
+> none of the pi are true, then the value of the entire expression is undefined.
+>
+> Each pi or ei can itself be either an S-expression, a function, a composition of
+> functions or may itself be another conditional expression.
+
+#### Example - conditional expression
+
+`[eq[car[x]; A] -> cons[B; cdr[x]]; T -> x]`
+
+The atomic symbol `T` represents truth. The value of this expression is obtained
+if one replaces `car` of `x` by B if it happens to be A, but leaving `x` unchanged if `car` of
it is not A.
-```
-```
+page 6
+
The main application of conditional expressions is in defining functions recursively.
-```
-Example
+#### Example
+`ff[x] = [atom[x] -> x; T -> ff[car[x]]]`
+
+This example defines the function `ff` which selects the first atomic symbol of any
+given expression. This expression can be read: If `x` is an atomic symbol, then `x`
+itself is the answer. Otherwise the function `ff` is to be applied to car of `x`.
+
+If `x` is atomic, then the first branch which is `x` will be selected. Otherwise, the
+second branch `ff[car[x]]` will be selected, since `T` is always true.
+
+The definition of `ff` is recursive in that `ff` is actually defined in terms of itself. If
+one keeps taking `car` of any S-expression, one will eventually produce an atomic symbol; therefore the process is always well defined.
+
+Some recursive functions may be well defined for certain arguments only, but infinitely recursive for certain other arguments. When such a function is interpreted in the LISP programming system, it will either use up all of the available memory, or loop until the program is halted artificially.
+
+We shall now work out the evaluation of `ff[((A. B). C)]`. First, we substitute the
+arguments in place of the variable `x` in the definition and obtain
```
-ff[x]=[atom[x]-x; T-ff[car[x]]]
-This example defines the function ff which selects the first atomic symbol of any
-given expression. This expression can be read: If x is an atomic symbol, then x
-itself is the answer. Otherwise the function ff is to be applied to car of x.
-If x is atomic, then the first branch which is x l1 will be selected. Otherwise, the
-second branch nff[car[x]]n will be selected, since T is always true.
-The definition of ff is recursive in that ff is actually deefined in terms of itself. If
-one keeps taking cay of any S-expression, one will eventually produce an atomic sym-
-bol; therefore the process is always well defined.
-Some recursive functions may be well defined for certain arguments only, but in-
-finitely recursive for certain other arguments. When such a function is interpreted in
-the LISP programming system, it will either use up all of the available memory, or
-loop until the program is halted artificially.
-We shall now work out the evaluation of ff[((A. B). c)]. First, we substitute the
-arguments in place of the variable x in the definition and obtain
-ff[((~. B). C)]=[atom[((A. B). c)]-((A. B). C); T-ff[car[((A. B). c)]]]
-but ((A. B). C) is not atomic, and so we have
-= [T-ff [car [((A. B). C )]]I
-= ff[car[((A. B). c)]]
-= ff[(~. B)]
-At this point, the definition of ff must be used recursively. Substituting (A. B)
-for x gives
-= [atom[(A. B)]-(A. B); Tdff[car[(A. B)]]]
-= [T-ff[car[(~. B)]]]
-= ff[car[(A. B)]]
+ff[((A . B) . C)]=[atom[((A . B) . C)]->((A . B) . C); T->ff[car[((A . B) . C)]]]
+```
+but `((A. B). C)` is not atomic, and so we have
+```
+= [T->ff [car[((A . B) . C)]]
+= ff[car[((A . B) . C)]]
+= ff[(A . B)]
+```
+At this point, the definition of ff must be used recursively. Substituting `(A . B)`
+for `x` gives
+```
+= [atom[(A . B)] -> (A . B); T -> ff[car[(A . B)]]]
+= [T -> ff[car[(A . B)]]]
+= ff[car[(A . B)]]
= ff[A]
-= [atom[A]-A; T-ff [car [A 111
+= [atom[A] -> A; T -> ff[car[A]]]
+= A
```
+The conditional expression is useful for defining numerical computations, as well as computations with S-expressions. The absolute value of a number can be defined by
```
-The conditional expression is useful for defining numerical computations, as well
-as computations with S-expressions. The absolute value of a number can be defined by
-```
-
+|x| = [x<0 -> -x; T -> x]
```
The factorial of a nonhnegative integer can be defined by
-n! =[n=0-1; T-n-[n-l]! 3
-This recursive definition does not terminate for negative arguments. A function that
```
+n! = [n=0 -> 1; T -> n.[n-l]!]
+```
+This recursive definition does not terminate for negative arguments. A function that
+
+page 7
is defined only for certain arguments is called a partial function.
-The Euclidean algorithm for finding the greatest common divisor of two positive
-integers can be defined by using conditional expressions as follows:
-rem[u;vi is the remainder when u is divided by 2
-A detailed discussion of the theory of functions defined recursively by conditional
-expressions is found in A Basis for a Mathematical Theory of Computation " by
-J. McCarthy, Proceedings of the Western Joint Computer Conference, May 1961
-(published by the Institute of Radio Engineers).
-It is usual for most mathematicians-exclusive of those devoted to logic-to use the
-word function imprecisely, and to apply it to forms such as JI^2 ts Because we
-shall later compute with expressions that stand for functions, we need a notation that
-expresses the distinction between functions and forms. The notation that we shall use
-is the lambda notation of Alonzo Church.^1
-Let be an expression that stands for a function of two integer variables. It
-should make sense to write f[3;4] and to be able to determine the value of this expres-
-sion. For example, sum[3;4]=7. The expression y^2 tx does not meet this requirement.
-It is not at all clear whether the value of y^2 +x[3;41 is 13 or 19. An expression such as
-y^2 tx will be called a form rather than a function. A form can be converted to a func-
-tion by specifying the correspondence between the variables in the form and the argu-
-ments of the desired function.
-If E is a form in the variables x l;.. .;xn, then the expression h[[x l;.. .;xn]; €
-represents the function of n variables obtained by substituting the n arguments in
-order for the variables xl;. .;xn, respectively. For example, the function ~[[x;~];
-y^2 tx] is a function of two variables, and )i[[x;y);y2+x1[3;4]=4^2 +3=19. ~[L~;xJY~+~I[~;~I
-=3^2 +4=13.
-The variables in a lambda expression are dummy or bound variables because sys-
-tematically changing them does not alter the meaning of the expression. Thus X[[u;vk
-v^2 tu] means the same thing as A[[X;~~~^2 tx].
-We shall sometimes use expressions in which a variable is not bound by a lambda.
-For example, in the function of two variables )i[[x;y~xntyn] the variable n is not
-bound. This is called a free variable. It may be regarded as a parameter. Unless
-n has been given a value before trying to compute with this function, the value of the
-function must be undefined.
+The Euclidean algorithm for finding the greatest common divisor of two positive integers can be defined by using conditional expressions as follows:
-1. A. Church, The Calculi of Lambda-Conversion (Princeton University Press,
- Princeton, New Jersey, 194r
+```
+gcd[x; y]=[x>y -> gcd[y; x];
+ rem[y;x]=0 -> x]
+```
-The lambda notation alone is inadequate for naming recursive functions. Not only
-must the variables be bound, but the name of the function must be bound, since it is
-used inside an expression to stand for the entire expression. The function ff was
-previously defined by the identity
+`rem[u; v]` is the remainder when `u` is divided by `v`.
+
+A detailed discussion of the theory of functions defined recursively by conditional expressions is found in [A Basis for a Mathematical Theory of Computation](http://jmc.stanford.edu/articles/basis/basis.pdf) by J. McCarthy, Proceedings of the Western Joint Computer Conference, May 1961 (published by the Institute of Radio Engineers).
+
+It is usual for most mathematicians -- exclusive of those devoted to logic -- to use the word 'function' imprecisely, and to apply it to forms such as y2+x. Because we shall later compute with expressions that stand for functions, we need a notation that expresses the distinction between functions and forms. The notation that we shall use is the [lambda notation of Alonzo Church](https://compcalc.github.io/public/church/church_calculi_1941.pdf).
+
+Let `f`be an expression that stands for a function of two integer variables. It
+should make sense to write `f[3; 4]` and to be able to determine the value of this expres-
+sion. For example, `sum[3; 4] = 7`. The expression y2 + x does not meet this requirement.
+It is not at all clear whether the value of y2 + x[3; 4] is 13 or 19. An expression such as
+y2 + x will be called a form rather than a function. A form can be converted to a function by specifying the correspondence between the variables in the form and the arguments of the desired function.
+
+If ε is a form in the variables x1;... ;xn, then the expression λ[[x1;... ;xn]ε] represents the function of n variables obtained by substituting the n arguments in order for the variables x1;... ;xn, respectively. For example, the function λ[[x; y]; y2 + x] is a function of two variables, and λ[[x; y]; y2 + x][3; 4] =42 + 3 = 19. λ[[x; y]; y2 + x][4; 3] = 32 + 4 = 13.
+
+*TODO: detail formatting in the above paragraph is still slightly wrong.*
+
+The variables in a lambda expression are dummy or bound variables because systematically changing them does not alter the meaning of the expression. Thus λ[[u; v]; u2 + v] means the same thing as λ[[x; y]; y2 + x].
+
+We shall sometimes use expressions in which a variable is not bound by a lambda. For example, in the function of two variables λ[[x; y]; xn + yn] the variable `n` is not bound. This is called a free variable. It may be regarded as a parameter. Unless `n` has been given a value before trying to compute with this function, the value of the function must be undefined.
+
+page 8
+
+The lambda notation alone is inadequate for naming recursive functions. Not only must the variables be bound, but the name of the function must be bound, since it is used inside an expression to stand for the entire expression. The function `ff` was previously defined by the identity
+
+`ff[x] = [atom[x] -> x; T -> ff[car[x]]]`
Using the lambda notation, we can write
-ff=h[[xh [atorn[x]-x; T-ff [car [x]]j)
-The equality sigq in these identities is actually not part of the LISP meta-language
-and is only a orutch until we develop the correct notation. The right side of the last
-equation cannot serve as an expression for the function &because there is nothing to
-indicate that the occurrence of ff inside it stands for the function that is being defined.
+
+`ff =` λ`[x] = [atom[x] -> x; T -> ff[car[x]]]`
+
+The equality sign in these identities is actually not part of the LISP meta-languageand is only a crutch until we develop the correct notation. The right side of the last equation cannot serve as an expression for the function `ff` because there is nothing to indicate that the occurrence of `ff` inside it stands for the function that is being defined.
+
In order to be able to write expressions that bear their own name, we introduce
-the label notatioe. If E is an expression, and o is its name, we write label[a;~].
-The function 3 can now be written without an equal sign:
+the label notation. If ε is an expression, and α is its name, we write label[α; ε].
-In this expression, is a bound variable, and ff is a bound function name.
+The function `ff` can now be written without an equal sign:
-1.5 Syntactic $ummaryl
-All parts of the LISP language have now been explained. That which follows is a
-complete gyntactic definition of the LISP language, together with semantic comments.
-The definition is given in Backus notation2 with the addition of three dots(.. .) to avoid
-naming unneccessary syntactic types.
-In Backus notation the symbols I1::=l1, I1", and It I fl are used. The rule
-::= I (. ) means that
-an $-expression is either an atomic symbol, or it is a left parenthesis followed by an
-S-expression followed by a dot followed by an S-expression followed by a right paren-
-thesis. The vertical bar means or " , and the angular brackets always enclose ele-
-ments of the syntax that is being defined.
-The Data Language
-CLETTER>::~AIB cI... IZ
+`label[ff =` λ`[[x]; [atom[x] -> x; T -> ff[car[x]]]]`
-## ::=0I112 I .,. (
+In this expression, `x` is a bound variable, and `ff` is a bound function name.
-```
-c atomic-symbol >::=
-::= I I
-Atomic symbols are the smallest entities in LISP. Their decomposition into char-
-acter s has no significance.
+### 1.5 Syntactic Summary
+
+[This section is for completeness and may be skipped upon first reading.]
+
+All parts of the LISP language have now been explained. That which follows is a complete syntactic definition of the LISP language, together with semantic comments. The definition is given in [Backus notation](https://www.softwarepreservation.org/projects/ALGOL/paper/Backus-ICIP-1959.pdf) with the addition of three dots(...) to avoid naming unnecessary syntactic types.
+
+In Backus notation the symbols `::=`, `<`, `>`, and `|` are used. The rule
+
+```BNF
+ ::= | ( . )
```
-1. This election is for completeness and may be skipped upon first reading.
-2. J. W. Backus, The Syntax and Semantics of the Proposed International Algebraic
-Language of the Zurich ACM-Gamm Conference. ICIP Paris, June 1959.
+means that an S-expression is either an atomic symbol, or it is a left parenthesis followed by an S-expression followed by a dot followed by an S-expression followed by a right parenthesis. The vertical bar means "or" , and the angular brackets always enclose elements of the syntax that is being defined.
-< S-expression >:: = (
-(. ) I
-(. ,. )
-When three dots are used in this manner, they mean that any number of the given
-type of symbol may occur, including none at all. According to this rule, ( ) is a valid
-S-expression. (It is equivalent to NIL. )
-The dot notation is the fundamental notation of S-expressions, although the list
-notation is often more convenient. Any Sdexpression can be written in dot notation.
-The Meta-Language
-::=alb(cl... (z
-::=
-::= I I
-The names of functions and variables are fornied in the same manner as atomic
-symbols but with lower -case letters.
+#### The Data Language
+```BNF
+ ::= A|B|C| ... |Z
+ ::= 0|1|2| ... |9
+ ::=
+ ::= | |
```
-A form is an expression that can be evaluated. A form that is merely a constant
-has that constant as its value. If a form is a variable, then the value of the form is
-the S-expression that is bound to that variable at the time when we evaluate the form,
-The third part of this rule states that we may write a function followed by a list of
-arguments separated by semicolons and enclosed in square brackets. The expressions
-for the arguments are themselves forms; this indicates that cornpasitions of functions
-are permitted.
-The last part of this rule gives the format of the conditional expression. This is
-evaluated by evaluating the forms in the propositional position in order until one is
-found whose value is T. Then the form after the arrow is evaluated and give$ the
-value of the entire expression.
-::= (
-k[;