[plt-scheme] How to make unit functors?
Matthew Flatt wrote:
>Ok, I see. My example was broken.
>
>It should have been
>
> > (define j1 'j)
> > (define j2 'J)
> > (eq? j1 j2)
> #t
> > (eq-hash-code j1)
> 511627
> > (eq-hash-code J2)
> 511627
>
>and so on.
>
>The effect you see in your transcript is that the symbol table is
>garbaged collected.
>
I was guessing that much.
>`eq?' implies the same hash code. If two values can't be compared
>(because no one has a reference to both at the same time), the hash
>codes are unrelated.
>
Ah!
>`equal-hash-code' doesn't have this problem --- intentionally, though I
>see that I didn't manage to express anything about it in the
>documentation.
>
>(Who knew that documenting hash-code functions could be so tricky?)
>
>
Not until now.
And prior to looking at your C-code, I hadn't imagined how tricky it was
to implement it either :-)
--
Jens Axel Søgaard