We are finally implementing functions!
Or at least, the primitive ones.
The functions are processed by an expression evaluator. The evaluator was first implemented on the BSETQ instruction. Attempts to update the IFGO to handle functions in the same build yielded broken code that resisted repair. As a result, functions (or equivalently, expressions) were added to IFGO in a separate build.
Because of the way the list reader and writer were written, BSETQ is often bulkier than the code it replaces. However, a lot of the code involves IFGO, and embedding function calls reduces the number of temporaries and instructions needed for test-and-jump. The new IFGO tests are often more complex than a simple EQ of two “variables”, so more than one temporary binding can be eliminated per IFGO.
cdr is the first function verified. It is easily tested by using any printable string. The cdr of a printable string of at least two characters is also a printable string. We can also test the nesting of function calls.
cons is the next function verified. I have generated names for one set of letters, and cons‘ing a letter to the beginning of a printable string also yields a printable string. cons has two arguments, so care must be taken to ensure we preserve data across recursive subroutine calls.
With a template for both one- and two-argument functions, we can figure out the rest, and then test them one by one.
A file filled with text will test readf.
IFGO and WRITEF tests eq.
car and byte are tested in combination with cons and cdr to produce strings.