[gambit-list] equal? and equal?-hash

Marc Feeley feeley at iro.umontreal.ca
Fri Dec 28 09:25:17 EST 2018


This is just a heads up that the implementation of equal? and equal?-hash has been completely rewritten.  These functions can now handle cycles and sharing, as shown in this example:

  > (define x (list 1 2 3))
  > (define y (list 1 2 3))
  > (set-cdr! (cddr x) x)
  > (set-cdr! (cddr y) x)
  > (equal? x y)
  #t
  > (equal?-hash x)
  29507628
  > (equal?-hash y)
  29507628
  > (list? x)
  #f
  > (list? y)
  #f

Note that equal?-hash is the default hash function that is used for tables created with make-table.

Due to the fundamental nature of equal?, I would be interested in feedback from users making frequent use of equal? and tables in their code.  Please report any performance degradation you notice (in particular because the new hash function may cause a change in the frequency of hash table collisions).

Marc




More information about the Gambit-list mailing list