pnathan / generic-comparability

implementation of cdr-8
http://cdr.eurolisp.org/document/8/cleqcmp.html
16 stars 2 forks source link

equals on hash tables is not yet functioning correctly #6

Open anticrisis opened 6 years ago

anticrisis commented 6 years ago

Sorry to report but something strange is going on. It appears as if the implementation is incomplete. Two simple hash tables are being reported as EQUALS T despite the fact that one has 1 item and the other has zero items.


CL-USER> (ql:quickload :generic-comparability)
To load "generic-comparability":
  Load 1 ASDF system:
    generic-comparability
; Loading "generic-comparability"

(:GENERIC-COMPARABILITY)
CL-USER> (in-package :generic-comparability)
#<PACKAGE "GENERIC-COMPARABILITY">
GENERIC-COMPARABILITY> (defvar a (make-hash-table :test 'equal))
A
GENERIC-COMPARABILITY> (defvar b (make-hash-table :test 'equal))
B
GENERIC-COMPARABILITY> (equals a b)
T
GENERIC-COMPARABILITY> (setf (gethash "a" a) 1)
1
GENERIC-COMPARABILITY> (equals a b)
T
GENERIC-COMPARABILITY> a
#<HASH-TABLE :TEST EQUAL :COUNT 1 {1001D4C343}>
GENERIC-COMPARABILITY> b
#<HASH-TABLE :TEST EQUAL :COUNT 0 {1001D4F013}>
GENERIC-COMPARABILITY> (equals b a)
T
GENERIC-COMPARABILITY> (defvar c (make-hash-table))
C
GENERIC-COMPARABILITY> (defvar d (make-hash-table))
D
GENERIC-COMPARABILITY> (equals c d)
T
GENERIC-COMPARABILITY> (setf (gethash :a c) 1)
1
GENERIC-COMPARABILITY> (equals c d)
T
GENERIC-COMPARABILITY> c
#<HASH-TABLE :TEST EQL :COUNT 1 {1001FCEB53}>
GENERIC-COMPARABILITY> d
#<HASH-TABLE :TEST EQL :COUNT 0 {1001FDEB13}>
GENERIC-COMPARABILITY> (equals c d :by-key nil)
T
GENERIC-COMPARABILITY> (equals a b :by-key nil)
T
GENERIC-COMPARABILITY> (equals c d :by-key t)
T
GENERIC-COMPARABILITY>