From 74dbd0dc965618dd574a74368439c5804d198346 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 24 Feb 2014 02:14:27 -0800 Subject: * eval.c (expand_qquote): Bugfix. Was not handling an unquote in the dotted position: (qquote x1 .. xn . (unquote form)), which looks like the structure (qquote x1 .. xn unquote form). Fixed by a hack: after recursively expanding the (unquote form) part (rest of the form), we check whether the unexpanded version has unquote at the front. If so, we know the expansion is just form, and use it to emit the suitable expansion. --- ChangeLog | 10 ++++++++++ eval.c | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3345d35b..267ea79a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2014-02-24 Kaz Kylheku + + * eval.c (expand_qquote): Bugfix. Was not handling an unquote + in the dotted position: (qquote x1 .. xn . (unquote form)), + which looks like the structure (qquote x1 .. xn unquote form). + Fixed by a hack: after recursively expanding the (unquote form) + part (rest of the form), we check whether the unexpanded + version has unquote at the front. If so, we know the expansion is just + form, and use it to emit the suitable expansion. + 2014-02-24 Kaz Kylheku Symbol macros. diff --git a/eval.c b/eval.c index e00dc879..95983441 100644 --- a/eval.c +++ b/eval.c @@ -2065,7 +2065,9 @@ static val expand_qquote(val qquoted_form, val menv) if (atom(r_ex)) { return rlcp(cons(append_s, cons(f_ex, r_ex)), qquoted_form); } else { - if (car(r_ex) == append_s) + if (consp(r) && car(r) == unquote_s) + r_ex = cons(r_ex, nil); + else if (car(r_ex) == append_s) r_ex = cdr(r_ex); return rlcp(cons(append_s, cons(f_ex, r_ex)), qquoted_form); } -- cgit v1.2.3