[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Equality and hashing for new datatypes
From: |
Robby Zambito |
Subject: |
Re: Equality and hashing for new datatypes |
Date: |
Fri, 23 Jun 2023 08:46:43 -0400 |
User-agent: |
mu4e 1.10.3; emacs 28.2 |
Taylan Kammer <taylan.kammer@gmail.com> writes:
> On 23.06.2023 00:45, Philip McGrath wrote:
>>
>> Thanks, but this is the opposite of what I want to do. The library I'm
>> porting
>> already supports creating tables with custom equality and hashing functions.
>> What I'm trying to do is make the standard `equal?` procedure recognize when
>> two of my table values are semantically the same even if internal
>> implementation details differ.
>>
>> (Note also that SRFI 69 and other libraries provide *mutable* hash tables.
>> The
>> Racket-on-Chez library I'm porting provides immutable hash tables, more
>> properly Hash Array Mapped Tries, as made famous by Clojure.)
>>
>> -Philip
>
> Ah, apologies then. As far as I know, there's no other way to do that in
> Guile
> than with GOOPS, which you've already mentioned.
>
> In standard Scheme there's no way to do it at all. I don't think there's even
> an SRFI for it (I just searched a bit, out of curiosity, couldn't find
> anything).
YASOS can be implemented in standard Scheme[1], but it has the same
limitations as GOOPS in this context. It cannot really be "injected"
into existing modules AFAIK.
Footnotes:
[1] https://notabug.org/PangolinTurtle/yasos-r7rs