summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-03-18 22:56:48 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-03-18 22:56:48 -0700
commit19a868e30bbae3ae01d176a8aca876a36f8dc571 (patch)
treef13fce06d5997df6561c49cfb24500cef58c6f2b
parentb80a900ed15ac03e4f63922ed61554978fb605e2 (diff)
downloadtxr-19a868e30bbae3ae01d176a8aca876a36f8dc571.tar.gz
txr-19a868e30bbae3ae01d176a8aca876a36f8dc571.tar.bz2
txr-19a868e30bbae3ae01d176a8aca876a36f8dc571.zip
interpose: eliminate state cons.
* lib.c (lazy_interpose_func, lazy_interpose): Pass list in car of lcons, and separator as function env.
-rw-r--r--lib.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib.c b/lib.c
index 072c34b9..cbf5c948 100644
--- a/lib.c
+++ b/lib.c
@@ -8565,27 +8565,23 @@ val window_mappend(val range, val boundary, val fun, val seq)
}
}
-static val lazy_interpose_func(val env, val lcons)
+static val lazy_interpose_func(val sep, val lcons)
{
- us_cons_bind (sep, list, env);
+ val list = us_car(lcons);
val next = cdr(list);
val fun = us_lcons_fun(lcons);
us_rplaca(lcons, car(list));
- if (next) {
- us_rplacd(env, next);
- func_set_env(fun, env);
- us_rplacd(lcons, cons(sep, make_lazy_cons(fun)));
- }
+ if (next)
+ us_rplacd(lcons, cons(sep, make_lazy_cons_car(fun, next)));
return nil;
}
static val lazy_interpose(val sep, val list)
{
- return make_lazy_cons(func_f1(cons(sep, list),
- lazy_interpose_func));
+ return make_lazy_cons_car(func_f1(sep, lazy_interpose_func), list);
}
val interpose(val sep, val seq)