summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-01-01 19:56:11 -0800
committerKaz Kylheku <kaz@kylheku.com>2018-01-01 19:56:11 -0800
commit6ac45e04ea817dcd6df3a749f523ed1b96ec0118 (patch)
treebfd8211f0d14cbc1978b231b3a2504209f72aa24 /eval.c
parent79a90b980192de7410a7e688e1c831f7878f8714 (diff)
downloadtxr-6ac45e04ea817dcd6df3a749f523ed1b96ec0118.tar.gz
txr-6ac45e04ea817dcd6df3a749f523ed1b96ec0118.tar.bz2
txr-6ac45e04ea817dcd6df3a749f523ed1b96ec0118.zip
Use rplaca and rplacd instead of set over car_l/cdr_l.
This reduces the proliferation of car_l and cdr_l. With this change, nreverse should work on chains of objects that implement rplacd. * combi.c (comb_gen_fun_common, rcomb_gen_fun_common): Use rplaca. * eval.c (mappendv, mapdov): Likewise * hash.c (hash_equal_op): Likewise. * lib.c (nreverse, acons_new, aconsql_new, sort_list): Use rplaca and rplacd. * match.c (dest_set, v_gather, v_collect, v_flatten, v_cat, v_output, v_filter): Likewise * parser.c (ensure_parser): Use sys_rplacd. * unwind.c (uw_register_subtype): Use rplacd.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 81c62d11..d82f2141 100644
--- a/eval.c
+++ b/eval.c
@@ -4706,7 +4706,7 @@ static val mappendv(val fun, struct args *lists)
return make_like(out, list_orig);
}
atail = list_collect(atail, car(list));
- deref(car_l(iter)) = cdr(list);
+ rplaca(iter, cdr(list));
}
otail = list_collect_append(otail, apply(fun, z(args)));
@@ -4801,7 +4801,7 @@ static val mapdov(val fun, struct args *lists)
return nil;
}
atail = list_collect(atail, car(list));
- deref(car_l(iter)) = cdr(list);
+ rplaca(iter, cdr(list));
}
apply(fun, z(args));