[Bug-openmcl] equalp comparing two hashes
bryan o'connor
bryan-openmcl at lunch.org
Tue Dec 7 20:06:57 MST 2004
%hash-table-equalp (called by equalp) uses the hash-table's :test
argument to compare the values instead of equalp.
spec says:
equalp descends hash-tables by first comparing the count of entries
and the :test function; if those are the same, it compares the keys of
the tables using the :test function and then the values of the
matching
keys using equalp recursively.
...bryan
-------------- next part --------------
Index: level-0/l0-hash.lisp
===================================================================
RCS file: /usr/local/tmpcvs/ccl-0.14-dev/ccl/level-0/l0-hash.lisp,v
retrieving revision 1.2
diff -c -r1.2 l0-hash.lisp
*** level-0/l0-hash.lisp 18 Nov 2003 06:59:56 -0000 1.2
--- level-0/l0-hash.lisp 8 Dec 2004 02:45:10 -0000
***************
*** 1606,1626 ****
(defun %hash-table-equalp (x y)
; X and Y are both hash tables
! (let* ((test (hash-table-test x)))
! (and (eq test
! (hash-table-test y))
! (eql (hash-table-count x)
! (hash-table-count y))
! (block nil
! (let* ((default (cons nil nil))
! (foo #'(lambda (k v)
! (let ((y-value (gethash k y default)))
! (unless (and (neq default y-value)
! (funcall test v y-value))
! (return nil))))))
! (declare (dynamic-extent foo default))
! (maphash foo x))
! t))))
(defun sxhash (s-expr)
"Computes a hash code for S-EXPR and returns it as an integer."
--- 1606,1625 ----
(defun %hash-table-equalp (x y)
; X and Y are both hash tables
! (and (eq (hash-table-test x)
! (hash-table-test y))
! (eql (hash-table-count x)
! (hash-table-count y))
! (block nil
! (let* ((default (cons nil nil))
! (foo #'(lambda (k v)
! (let ((y-value (gethash k y default)))
! (unless (and (neq default y-value)
! (equalp v y-value))
! (return nil))))))
! (declare (dynamic-extent foo default))
! (maphash foo x))
! t)))
(defun sxhash (s-expr)
"Computes a hash code for S-EXPR and returns it as an integer."
-------------- next part --------------
More information about the Bug-openmcl
mailing list