Print changes

This commit is contained in:
2026-08-13 02:41:41 -07:00
parent 046b9b0c87
commit 7b854c1559
11 changed files with 438 additions and 26 deletions
+18
View File
@@ -4,6 +4,8 @@
#include "init_globals.h"
#include "lisp_string.h"
#include <locale.h>
LispVal *obarray;
static void construct_manual_symbols(void) {
@@ -131,6 +133,22 @@ DEFSPECIAL(progn, "progn", (LispVal * forms), "(&rest forms)", "") {
return rval;
}
DEFSPECIAL(setq, "setq", (LispVal * bindings), "(&rest bindings)", "") {
size_t nbindings = list_length(bindings);
if (nbindings < 2 || (nbindings & 1) != 0) {
// TODO error
abort();
}
LispVal *value = Qnil;
for (LispVal *rest = bindings; !NILP(bindings);
bindings = XCDR(XCDR(bindings))) {
LispVal *name = FIRST(rest);
value = Feval(SECOND(rest), Vlexical_environment);
set_lexical_variable(name, value);
}
return value;
}
DEFSPECIAL(let, "let", (LispVal * bindings, LispVal *body),
"(bindings &rest body)", "") {
CHECK_LISTP(bindings);