Max

Tril tril@tunes.org
Sat, 22 Mar 2003 02:14:06 -0800


Since I have worked on Max a bit since you looked at it, and you may=20
want to figure out what is going on before meeting me again, I'm writing=20
this e-mail so you can have an idea of what to look at quickly when you=20
have time to look at it but not to meet me or ask me or whatever.

The tests are great documentation for the way Max should work, and they
may help a lot in understanding the changes I made recently.  Currently,
there are tests in ADDR.LSP, BOOLEAN.LSP, and FUNCTION.LSP.  I put the
tests at the end of each file.  You can consider the tests a "second
half" of each module, since they are an important part that defines how
the module acts.  Each test is basically one comparison, with a clear
failure message so you know what the comparison means.

Basically what I did today was make the space of functions.  Every max
function has an address in that space.  Now the properties of a function
are its domain and codomain- and properties are stored in functions in
Max. So, the domain and codomain used to be stored in fields- now they
are their own functions.  You give the address of a function to the
"domain" function, and it returns the address of the space which is that
function's domain.  Similarly with "Codomain".  The implementation of a
function is a hash table.  This hash table used to be stored in the 3rd
field of a function's address- now it is stored somewhere else.  Go into
Max and type "(show-ht (space-hash *functions*))". SPACE-HASH returns
the hash-table associated with a given space.  Each space's hash table
has KEYs for the addresses in the space, and the VALUEs associated with
those KEYs can be used for storing implementation information for the
addresses in the space.  In this case, the space is *functions*, and the
implementation of a function is its definition (a hash table mapping
arguments to results).

Earlier, I made the space of spaces.  The hash table implementing each
space used to be stored in a field in the address returned by
MAKE-SPACE.  Now, the space's hash table is stored in a hash table
called *sos* (for space of spaces), looked up by the space's address.
Note in that the output of (show-ht *sos*) is not any clearer than just
typing *sos*, because in the former case the entire hash table has to be
printed anyway since it is inside itself.  If you just type *sos*, you
get LISP's *print-circle*'s nice view of the circular structure.  Ignore
the #:FUNCTION part- that's the space of functions, you already saw that
=66rom the last paragraph, and it also wasn't there when I first
implemented the space of spaces.  Just follow the vertical spacing of
the items in *sos* and you will see each space, followed by a dot,
followed by its hash table implementation (containing all the addresses
in that space).

*spaces* is the Max address of the space of spaces.  Its implementation=20
is *sos*, but (addr-value *spaces*) =3D=3D #:SPACE is one of the keys in=20
*sos*, and *sos* is the value associated with that key.  This allows=20
SPACE-HASH to not need a special-case when looking up the space of=20
spaces (space-hash *spaces*), since it can do what it does for all the=20
other spaces.

I'm wondering now if this stuff is more complicated than what you=20
learned in 410, and if you're now ready for it anyway.  I then wonder if=20
Matthews would be interested in seeing this stuff.