Print changes
This commit is contained in:
+18
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user