[plt-scheme] equal? for native extension types [patch]

From: Daniel Yoo (dyoo at cs.wpi.edu)
Date: Tue Feb 13 19:40:03 EST 2007

On Tue, 13 Feb 2007, Dimitris Vyzovitis wrote:

> equal? knows about some built-in types and structs -- and that's about 
> it. If you happen to define extension types with meaningful equality 
> tests, then you are stuck. Quite frustrating.

Hi Dimitris,

If structures are transparent, by setting their inspector appropriately, 
then equal? will work on them.

For example:

> (define-struct dummy (val) #f)
> (define x1 (make-dummy 1))
> (define x2 (make-dummy 2))
> (define x3 (make-dummy 1))
> (equal? x1 x3)
> (equal? x1 x2)
> (eq? x1 x3)





Best of wishes!

Posted on the users mailing list.