Apply and read errors

This commit is contained in:
2026-09-05 07:05:12 -07:00
parent 4aeb7c0be5
commit 8ec08a55ea
10 changed files with 83 additions and 15 deletions
+12 -1
View File
@@ -485,6 +485,14 @@ DEFUN(funcall, "funcall", (LispVal * func, LispVal *args), "(func &rest args)",
return UNWIND_AND_RETURN(stack_ref, raw_funcall(res, args));
}
DEFUN(apply, "apply", (LispVal * func, LispVal *args), "(func &rest args)",
"") {
if (NILP(args)) {
return CALL0(func);
}
return Ffuncall(func, Flist_star(XCAR(args), XCDR(args)));
}
static LispVal *parse_lambda_declare_form(LispFunction *fobj, LispVal *body) {
while (CONSP(body) && CONSP(XCAR(body)) && EQ(XCAR(XCAR(body)), Qdeclare)) {
LispVal *decls = XCDR(XCAR(body));
@@ -588,7 +596,10 @@ DEFUN(special_form_p, "special-form-p", (LispVal * val), "(val)", "") {
return builtin_function_p(val, true) ? Qt : Qnil;
}
DEFINE_SYMBOL(declare, "declare");
DEFSPECIAL(declare, "declare", (LispVal * forms), "(&rest forms)", "") {
lisp_signal(Qerror,
LIST(LISP_LITSTR("(declare ...) form in invalid position")));
}
DEFINE_SYMBOL(name, "name");
DEFINE_SYMBOL(callable, "callable");