Many different sequence functions

This commit is contained in:
2025-09-24 04:30:36 -07:00
parent 6d34641c5a
commit 93932349f5
3 changed files with 411 additions and 90 deletions

View File

@ -391,6 +391,7 @@ void lisp_shutdown(void);
noreturn DECLARE_FUNCTION(exit, (LispVal * code));
DECLARE_FUNCTION(id, (LispVal * obj));
DECLARE_FUNCTION(eq, (LispVal * obj1, LispVal *obj2));
DECLARE_FUNCTION(equal, (LispVal * obj1, LispVal *obj2));
DECLARE_FUNCTION(breakpoint, (LispVal * id));
DECLARE_FUNCTION(not, (LispVal * obj));
DECLARE_FUNCTION(type_of, (LispVal * val));
@ -470,15 +471,6 @@ DECLARE_FUNCTION(plist_set, (LispVal * plist, LispVal *key, LispVal *value,
DECLARE_FUNCTION(plist_rem, (LispVal * plist, LispVal *key, LispVal *pred));
DECLARE_FUNCTION(plist_assoc, (LispVal * plist, LispVal *key, LispVal *pred));
// ####################
// # String Functions #
// ####################
DECLARE_FUNCTION(stringp, (LispVal * val));
DECLARE_FUNCTION(hash_string, (LispVal * obj));
DECLARE_FUNCTION(strings_equal, (LispVal * obj1, LispVal *obj2));
LispVal *sprintf_lisp(const char *format, ...) PRINTF_FORMAT(1, 2);
bool strings_equal_nocase(const char *s1, const char *s2, size_t n);
// #####################
// # Package Functions #
// #####################
@ -517,11 +509,11 @@ DECLARE_FUNCTION(intern,
LispVal *intern(const char *name, size_t length, bool take, LispVal *package,
bool included_too);
// #######################
// ########################
// # Hash Table Functions #
// #######################
DECLARE_FUNCTION(hashtablep, (LispVal * val));
DECLARE_FUNCTION(make_hashtable, (LispVal * hash_fn, LispVal *eq_fn));
// ########################
DECLARE_FUNCTION(hash_table_p, (LispVal * val));
DECLARE_FUNCTION(make_hash_table, (LispVal * hash_fn, LispVal *eq_fn));
DECLARE_FUNCTION(copy_hash_table, (LispVal * table));
DECLARE_FUNCTION(hash_table_count, (LispVal * table));
DECLARE_FUNCTION(puthash, (LispVal * table, LispVal *key, LispVal *value));
@ -552,7 +544,24 @@ DECLARE_FUNCTION(sub, (LispVal * args));
// # Vector Functions #
// ####################
DECLARE_FUNCTION(vectorp, (LispVal * val));
DECLARE_FUNCTION(make_vector, (LispVal * size, LispVal *initial_elem));
DECLARE_FUNCTION(vector, (LispVal * elems));
DECLARE_FUNCTION(vector_length, (LispVal * vec));
DECLARE_FUNCTION(aref, (LispVal * vec, LispVal *index));
DECLARE_FUNCTION(aset, (LispVal * vec, LispVal *index, LispVal *elem));
DECLARE_FUNCTION(subvector, (LispVal * vec, LispVal *start, LispVal *end));
// many vector functions also work on strings
// ####################
// # String Functions #
// ####################
DECLARE_FUNCTION(stringp, (LispVal * val));
DECLARE_FUNCTION(string, (LispVal * chars));
DECLARE_FUNCTION(hash_string, (LispVal * obj));
DECLARE_FUNCTION(strings_equal, (LispVal * obj1, LispVal *obj2));
DECLARE_FUNCTION(string_to_vector, (LispVal * str));
LispVal *sprintf_lisp(const char *format, ...) PRINTF_FORMAT(1, 2);
bool strings_equal_nocase(const char *s1, const char *s2, size_t n);
// ########################
// # Lexenv and the Stack #
@ -670,6 +679,7 @@ extern LispVal *Qreturn_frame_error;
extern LispVal *Qpackage_exists_error;
extern LispVal *Qimport_error;
extern LispVal *Qunknown_package_error;
extern LispVal *Qout_of_bounds_error;
#define CHECK_TYPE(type, val) \
if (TYPEOF(val) != type) { \