trying to trace equal-hash-code with structures.

This commit is contained in:
Danny Yoo 2011-11-04 17:46:50 -04:00
parent 6b20b6e1fc
commit 522b1866c8
3 changed files with 11 additions and 11 deletions

View File

@ -92,9 +92,9 @@
Cons.prototype.hashCode = function(depth) {
var k = baselib.hashes.getEqualHashCode("Cons");
k += baselib.hashes.getEqualHashCode(this.first);
k += baselib.hashes.getEqualHashCode(this.first, depth);
k = baselib.hashes.hashMix(k);
k += baselib.hashes.getEqualHashCode(this.rest);
k += baselib.hashes.getEqualHashCode(this.rest, depth);
k = baselib.hashes.hashMix(k);
return k;
};

View File

@ -65,7 +65,7 @@
var i;
k = baselib.hashes.hashMix(k);
for (i = 0; i < this._fields.length; i++) {
k += baselib.hashes.getEqualHashCode(this._fields[i]);
k += baselib.hashes.getEqualHashCode(this._fields[i], depth);
k = baselib.hashes.hashMix(k);
}
return k;

View File

@ -48,12 +48,12 @@
(equal-hash-code (make-thing "danny" 32))
(equal-hash-code (shared ([a (make-thing a a)]) a))
;; symbols
"symbols"
(equal-hash-code 'hello)
(equal-hash-code 'world)
;; ;; symbols
;; "symbols"
;; (equal-hash-code 'hello)
;; (equal-hash-code 'world)
;; vectors
"vectors"
(equal-hash-code #(1 2 3 4 5))
(equal-hash-code (shared ([v (vector 1 2 v 3 v)]) v))
;; ;; vectors
;; "vectors"
;; (equal-hash-code #(1 2 3 4 5))
;; (equal-hash-code (shared ([v (vector 1 2 v 3 v)]) v))