A buch of sequence functions

This commit is contained in:
2025-09-24 05:24:33 -07:00
parent 93932349f5
commit 02736718dc
3 changed files with 50 additions and 0 deletions

View File

@ -2443,6 +2443,17 @@ DEFUN(hash_table_count, "hash-table-count", (LispVal * table)) {
return make_lisp_integer(((LispHashtable *) table)->count);
}
DEFUN(maphash, "maphash", (LispVal * func, LispVal *table)) {
HT_FOREACH_VALID_INDEX(table, i) {
LispVal *args =
const_list(true, 2, HASH_KEY(table, i), HASH_VALUE(table, i));
WITH_CLEANUP(args, {
refcount_unref(Ffuncall(func, args)); //
});
}
return Qnil;
}
DEFUN(puthash, "puthash", (LispVal * table, LispVal *key, LispVal *value)) {
return refcount_ref(puthash(table, key, value));
}
@ -3522,4 +3533,5 @@ static void register_symbols_and_functions(void) {
REGISTER_FUNCTION(string, "(val)", "");
REGISTER_FUNCTION(subvector, "(seq &opt start end)", "");
REGISTER_FUNCTION(string_to_vector, "(str)", "");
REGISTER_FUNCTION(maphash, "(func table)", "");
}