hash-equal?
This commit is contained in:
parent
4c4d4437b8
commit
36801f7c54
|
@ -90,6 +90,7 @@
|
|||
'prop:exn:srclocs
|
||||
|
||||
'hash?
|
||||
'hash-equal?
|
||||
'hash-eq?
|
||||
'hash-eqv?
|
||||
'hash
|
||||
|
|
|
@ -361,6 +361,10 @@
|
|||
return (x instanceof WhalesongHashtable || x instanceof WhalesongImmutableHashtable);
|
||||
};
|
||||
|
||||
var isHashEqual = function (x) {
|
||||
return (x instanceof WhalesongHashtable || x instanceof WhalesongImmutableHashtable) && x.type === 'hash';
|
||||
};
|
||||
|
||||
var isHashEqv = function (x) {
|
||||
return (x instanceof WhalesongHashtable || x instanceof WhalesongImmutableHashtable) && x.type === 'hasheqv';
|
||||
};
|
||||
|
@ -437,6 +441,8 @@
|
|||
exports.makeImmutableEqualHashtable = makeImmutableEqualHashtable;
|
||||
|
||||
exports.isHash = isHash;
|
||||
|
||||
exports.isHashEqual = isHashEqual;
|
||||
exports.isHashEqv = isHashEqv;
|
||||
exports.isHashEq = isHashEq;
|
||||
}(window.plt.baselib, Hashtable));
|
|
@ -2524,6 +2524,12 @@
|
|||
function(M) {
|
||||
return baselib.hashes.isHash(checkAny(M, 'hash?', 0));
|
||||
});
|
||||
installPrimitiveProcedure(
|
||||
'hash-equal?',
|
||||
1,
|
||||
function(M) {
|
||||
return baselib.hashes.isHashEqual(checkAny(M, 'hash-equal?', 0));
|
||||
});
|
||||
installPrimitiveProcedure(
|
||||
'hash-eq?',
|
||||
1,
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
with-continuation-mark
|
||||
|
||||
hash?
|
||||
hash-equal?
|
||||
hash-eq?
|
||||
hash-eqv?
|
||||
hash
|
||||
|
|
|
@ -27,6 +27,9 @@ not-found
|
|||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
|
@ -58,3 +61,13 @@ alphabet
|
|||
|
||||
1
|
||||
2
|
||||
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
false
|
||||
false
|
||||
false
|
||||
true
|
||||
|
|
|
@ -80,6 +80,9 @@
|
|||
(hash? (make-immutable-hash))
|
||||
(hash? (make-immutable-hasheq))
|
||||
(hash? (make-immutable-hasheqv))
|
||||
(hash-equal? (make-immutable-hash))
|
||||
(hash-equal? (make-immutable-hasheq))
|
||||
(hash-equal? (make-immutable-hasheqv))
|
||||
(hash-eq? (make-immutable-hash))
|
||||
(hash-eq? (make-immutable-hasheq))
|
||||
(hash-eq? (make-immutable-hasheqv))
|
||||
|
@ -137,4 +140,15 @@
|
|||
(newline)
|
||||
(hash-count (make-hash '((a . a))))
|
||||
(hash-count (make-immutable-hash '((b . b)
|
||||
(c . d))))
|
||||
(c . d))))
|
||||
|
||||
(newline)
|
||||
(hash-equal? (make-hash))
|
||||
(hash-equal? (make-hasheq))
|
||||
(hash-equal? (make-hasheqv))
|
||||
(hash-eq? (make-hash))
|
||||
(hash-eq? (make-hasheq))
|
||||
(hash-eq? (make-hasheqv))
|
||||
(hash-eqv? (make-hash))
|
||||
(hash-eqv? (make-hasheq))
|
||||
(hash-eqv? (make-hasheqv))
|
||||
|
|
Loading…
Reference in New Issue
Block a user