summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eval.c12
-rw-r--r--tests/012/struct.tl8
2 files changed, 14 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index ad0b8bdd..23afd828 100644
--- a/eval.c
+++ b/eval.c
@@ -52,6 +52,7 @@
#include "txr.h"
#include "combi.h"
#include "lisplib.h"
+#include "cadr.h"
#include "eval.h"
#define max(a, b) ((a) > (b) ? (a) : (b))
@@ -2080,13 +2081,20 @@ static val me_pprof(val form, val menv)
static val me_when(val form, val menv)
{
(void) menv;
- return cons(cond_s, cons(rest(form), nil));
+
+ return if3(cdddr(form),
+ cons(cond_s, cons(cdr(form), nil)),
+ cons(if_s, cdr(form)));
}
static val me_unless(val form, val menv)
{
+ val test = cadr(form);
+ val body = cddr(form);
+
(void) menv;
- return list(if_s, second(form), nil, cons(progn_s, rest(rest(form))), nao);
+
+ return list(if_s, test, nil, maybe_progn(body), nao);
}
static val me_while(val form, val menv)
diff --git a/tests/012/struct.tl b/tests/012/struct.tl
index d9ecc325..cc4bd79b 100644
--- a/tests/012/struct.tl
+++ b/tests/012/struct.tl
@@ -74,11 +74,11 @@
\ '(x y) () (lambda (#:g0004)\n \
\ (let ((#:g0005 (struct-type #:g0004)))\n \
\ (if (static-slot-p #:g0005 'x)\n \
- \ () (progn (slotset #:g0004 'x\n \
- \ 0)))\n \
+ \ () (slotset #:g0004 'x\n \
+ \ 0))\n \
\ (if (static-slot-p #:g0005 'y)\n \
- \ () (progn (slotset #:g0004 'y\n \
- \ 0)))))\n \
+ \ () (slotset #:g0004 'y\n \
+ \ 0))))\n \
\ (lambda (#:g0004 #:g0006\n \
\ #:g0007)\n \
\ (slotset #:g0004 'x\n \