[plt-scheme] equal? operator

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Nov 22 08:52:04 EST 2005

At Tue, 22 Nov 2005 07:58:24 +0100, Hans Oesterholt-Dijkema wrote:
>         (hash-table-put! PROOS-STORE (-> obj list-poid) (make-weak-box obj))

Ok, but I'm still missing something, because I don't see how the table
accomplishes anything. In particular, ekeeping the key maintains the
mapping to the weak box, but it doesn't keep the weak box from getting

>  > (define a (car (psearch (all illness-class-category))))
>  > (define b (car (psearch (all illness-class-category))))

Are `a' and `b' keys here?

>  > (proos-store->list)
> (((59872449310226502864700443097271) #<weak-box>))
>  > (collect-garbage)
>  > (proos-store->list)
> (((59872449310226502864700443097271) #<weak-box>))
>  > (collect-garbage)
>  > (proos-store->list)
> (((59872449310226502864700443097271) #<weak-box>))

Ok, but is what's in the weak box --- an object or #f?

Looking back at your problem description, maybe what I'm missing is
that it's ok for for the weak box to be emptied, because this table
implements a cache?

> However when I don't use the (list) around the oid, It won't work.
> Isn't there a way without the 'equal property on the hash table?

Using symbols instead of numbers might be the right trade-off. Symbols
are allocated and collected, like lists, but they are also interned,
like small integers.


Posted on the users mailing list.