summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-05-13 20:13:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-05-13 20:13:29 -0700
commit5a383a288d620b9ae6111d9f33b9e420d3fcd0f8 (patch)
tree7677e1e5b0c6ba83c5f590c70d2f8d24128c514a
parent305c3638096b12715ee37904fc46f37b7fa0baa6 (diff)
downloadtxr-5a383a288d620b9ae6111d9f33b9e420d3fcd0f8.tar.gz
txr-5a383a288d620b9ae6111d9f33b9e420d3fcd0f8.tar.bz2
txr-5a383a288d620b9ae6111d9f33b9e420d3fcd0f8.zip
Recursive lcons force bug (keep-if*, remove-if*).
* lib.c (rem_lazy_func): Do not access the cdr field of the lcons that we are in the middle of forcing!
-rw-r--r--ChangeLog7
-rw-r--r--lib.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d666f83..5b68c559 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2015-05-13 Kaz Kylheku <kaz@kylheku.com>
+ Recursive lcons force bug (keep-if*, remove-if*).
+
+ * lib.c (rem_lazy_func): Do not access the cdr field of
+ the lcons that we are in the middle of forcing!
+
+2015-05-13 Kaz Kylheku <kaz@kylheku.com>
+
* place.tl (define-modify-macro): New macro.
* lisplib.c (set_place_dlt_entries): Add define-modify-macro.
diff --git a/lib.c b/lib.c
index a1dd429e..28e58240 100644
--- a/lib.c
+++ b/lib.c
@@ -1153,7 +1153,9 @@ static val rem_lazy_rec(val obj, val list, val env, val func);
static val rem_lazy_func(val env, val lcons)
{
cons_bind (pred, list, env);
- return cdr(rplacd(lcons, rem_lazy_rec(pred, list, env, lcons_fun(lcons))));
+ val rest = rem_lazy_rec(pred, list, env, lcons_fun(lcons));
+ rplacd(lcons, rem_lazy_rec(pred, list, env, lcons_fun(lcons)));
+ return rest;
}
static val rem_lazy_rec(val pred, val list, val env, val func)