Comparison with equal

This commit is contained in:
2026-09-07 18:59:09 -07:00
parent b4492e5cf7
commit 3d7b80691c
4 changed files with 85 additions and 6 deletions
+7 -3
View File
@@ -36,7 +36,7 @@ DEFUN(hash_table_p, "hash-table-p", (LispVal * val), "(val)", "") {
}
DEFUN(make_hash_table, "make-hash-table", (LispVal * hash_fn, LispVal *eq_fn),
"(hash-fn eq-fn)", "") {
"(&optional hash-fn eq-fn)", "") {
LispHashTable *obj =
lisp_alloc_object(sizeof(LispHashTable), TYPE_HASH_TABLE);
obj->eq_fn = eq_fn;
@@ -56,8 +56,12 @@ static uintptr_t hash_key_for_table(LispHashTable *ht, LispVal *key) {
return XFIXNUM(Fhash_string(key));
} else {
LispVal *hash = CALL(ht->hash_fn, key);
CHECK_TYPE(hash, TYPE_FIXNUM);
return XFIXNUM(hash);
if (LISP_GMP_P(hash)) {
return mpz_get_ui(((LispGmp *) hash)->val);
} else if (FIXNUMP(hash)) {
return XFIXNUM(hash);
}
signal_type_error(hash, Qinteger);
}
}