summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-11 22:08:33 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-11 22:08:33 -0800
commit37c881d461e55d5c5115c6c6ed397a3df8913fd2 (patch)
treecd944b1df641c86eea458a14c1d9ab9508a9425d /eval.c
parent926ad2e614f5c4c817e3ed8b560ded9045a7ccba (diff)
downloadtxr-37c881d461e55d5c5115c6c6ed397a3df8913fd2.tar.gz
txr-37c881d461e55d5c5115c6c6ed397a3df8913fd2.tar.bz2
txr-37c881d461e55d5c5115c6c6ed397a3df8913fd2.zip
Clause in case{q,ql,qual} with no forms yields nil.
* eval.c (me_case): If forms is nil, substitute the object (nil) for forms, to ensure a nil result through the expansion to a cond. * txr.1: Documented and added compat notes.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index f863e5fd..e0c852b0 100644
--- a/eval.c
+++ b/eval.c
@@ -3132,6 +3132,7 @@ static val me_case(val form, val menv)
val testform = pop(&form);
val tformsym = gensym(lit("test-"));
val memfuncsym, eqfuncsym;
+ val lofnil = cons(nil, nil);
list_collect_decl (condpairs, ptail);
if (casesym == caseq_s) {
@@ -3167,12 +3168,13 @@ static val me_case(val form, val menv)
nao),
forms));
} else {
+ uses_or2;
ptail = list_collect(ptail,
cons(list(if3(atom(keys), eqfuncsym, memfuncsym),
tformsym,
list(quote_s, keys, nao),
nao),
- forms));
+ or2(forms, lofnil)));
}
}