diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-03-18 22:56:48 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-03-18 22:56:48 -0700 |
commit | 19a868e30bbae3ae01d176a8aca876a36f8dc571 (patch) | |
tree | f13fce06d5997df6561c49cfb24500cef58c6f2b /lib.c | |
parent | b80a900ed15ac03e4f63922ed61554978fb605e2 (diff) | |
download | txr-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.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -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) |