[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Jon L White <firstname.lastname@example.org>
- Subject: Re: HASH-TABLE-PRINTED-REPRESENTATION
- From: Dave.Touretzky@B.GP.CS.CMU.EDU
- Date: Mon, 23 May 88 19:12:54 EDT
- Cc: email@example.com
- In-reply-to: Your message of Mon, 23 May 88 15:37:48 -0700. <8805232237.AA01719@bhopal.lucid.com>
Okay, here's a fix for the "fatal flaw" JonL objects to.
The full syntax for #H could be:
#nH(type s t (ki vi)*)
"n" is the current size of the hash table, and is optional
"type" is one of EQ, EQL, or EQUAL, and defaults to EQL
"s" is the rehash-size, and is optional
"t" is the rehash-threshold, and is optional
Since this hairs up the printed representation quite a bit,
which interferes with my pedagogical objective for making
hash tables visible objects, I also suggest the following
*PRINT-HASH* may take one of three values:
NIL means use #<HASH-TABLE...> notation
T means use the full #nH syntax; useful for file i/o
:BRIEF means use an abbreviated syntax
The abbreviated syntax leaves out the "n", "s" and "t"
components, and leaves out the type as well if it is EQL.
So in CMU Common Lisp the object #H((FOO 37) (BAR 42))
would print as either
#65H(EQL 101 65 (FOO 37) (BAR 42))
with *PRINT-HASH* set to T, or as
#H((FOO 37) (BAR 42))
with *PRINT-HASH* set to :BRIEF.
The keyword :BRIEF might not be exactly the right one to use, but I'll
leave that for others to decide. I think there was some discussion about
making *PRINT-STRUCTURE* take one of three values, to control when
user-supplied print functions were invoked or not. Does anyone remember
what the third value was supposed to be?
One more clarification:
- even with *PRINT-HASH* set to T, an implementation is free to
not print "n", "s", and "t" components if it chooses. It may
omit "type" as well if the type is EQL. But it must accept
all these components when reading #H expressions.