A lot of work

This commit is contained in:
2026-01-19 05:57:18 -08:00
parent c7af58f674
commit c63b104bc6
12 changed files with 217 additions and 13 deletions

View File

@ -91,12 +91,19 @@ static ALWAYS_INLINE LispVal *LIST_N(int count, ...) {
}
#define LIST(...) MACRO_CALLN(LIST, __VA_ARGS__)
#define FIRST(x) XCAR(x)
#define SECOND(x) XCAR(XCDR(x))
#define THIRD(x) XCAR(XCDR(XCDR(x)))
#define FOURTH(x) XCAR(XCDR(XCDR(XCDR(x))))
#define FIFTH(x) XCAR(XCDR(XCDR(XCDR(XCDR(x)))))
#define FOREACH(l, v) \
for (LispVal *_tail = (l), *v = XCAR(_tail); !NILP(_tail); \
_tail = XCDR(_tail), v = XCAR(_tail))
#define FOREACH_TAIL(l, v) for (LispVal *v = (l); !NILP(v); v = XCDR_SAFE(v))
// return -1 list is circular
intptr_t list_length(LispVal *list);
// Return true if the length of LIST == SIZE
bool list_length_eq(LispVal *list, intptr_t size);