mes.c: begin_env: bugfix, keep going in body after set!

This commit is contained in:
Jan Nieuwenhuizen 2016-07-17 09:17:47 +02:00
parent 6baafb2380
commit c565e2fc22
2 changed files with 11 additions and 8 deletions

17
mes.c
View file

@ -1110,15 +1110,16 @@ eval_quasiquote (scm *e, scm *a)
#endif #endif
if (e == &scm_nil) return e; if (e == &scm_nil) return e;
else if (atom_p (e) == &scm_t) return e; else if (atom_p (e) == &scm_t) return e;
else if (eq_p (car (e), &scm_symbol_quote) == &scm_t) // else if (eq_p (car (e), &scm_symbol_quote) == &scm_t)
return cons (car (e), eval_quasiquote (cdr (e), a)); // return cons (car (e), eval_quasiquote (cdr (e), a));
else if (eq_p (car (e), &scm_symbol_quasiquote) == &scm_t) // else if (eq_p (car (e), &scm_symbol_quasiquote) == &scm_t)
return cons (e, eval_quasiquote (cdr (e), a)); // return cons (e, eval_quasiquote (cdr (e), a));
else if (eq_p (car (e), &scm_symbol_unquote) == &scm_t) else if (eq_p (car (e), &scm_symbol_unquote) == &scm_t)
return eval (cadr (e), a); return eval (cadr (e), a);
else if (atom_p (car (e)) == &scm_t) // else if (atom_p (car (e)) == &scm_t)
return cons (car (e), eval_quasiquote (cdr (e), a)); // return cons (car (e), eval_quasiquote (cdr (e), a));
else if (eq_p (caar (e), &scm_symbol_unquote_splicing) == &scm_t) else if (e->type == PAIR && e->car->type == PAIR
&& eq_p (caar (e), &scm_symbol_unquote_splicing) == &scm_t)
return append2 (eval_ (cadar (e), a), eval_quasiquote (cdr (e), a)); return append2 (eval_ (cadar (e), a), eval_quasiquote (cdr (e), a));
return cons (eval_quasiquote (car (e), a), eval_quasiquote (cdr (e), a)); return cons (eval_quasiquote (car (e), a), eval_quasiquote (cdr (e), a));
} }
@ -1217,7 +1218,7 @@ begin_env (scm *body, scm *a)
return begin_env (cdr (body), cons (define_macro (e, a), a)); return begin_env (cdr (body), cons (define_macro (e, a), a));
else if (eq_p (car (e), &scm_symbol_set_x) == &scm_t) { else if (eq_p (car (e), &scm_symbol_set_x) == &scm_t) {
set_env_x (cadr (e), eval (caddr (e), a), a); set_env_x (cadr (e), eval (caddr (e), a), a);
return begin_env (cdr (e), a); return begin_env (cdr (body), a);
} }
#if BOOT #if BOOT
else if (eq_p (e, &scm_symbol_EOF) == &scm_t) else if (eq_p (e, &scm_symbol_EOF) == &scm_t)

View file

@ -129,6 +129,8 @@
(display 'a=0:) (display 'a=0:)
(display a) (display a)
(newline) (newline)
(display "set!")
(display (set! a 1))
(set! a 1) (set! a 1)
(display 'a=1:) (display 'a=1:)
(display a) (display a)