summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-11-21 07:05:32 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-11-21 07:05:32 -0800
commit8b237b2dcd460efb9f15494595bc0b429a76a438 (patch)
treea51cfceea90e3bb3def7f89e7d28d838e4a408a8 /lib.c
parent7320959c0a70a679011d0a0e0d2e43c586f631ab (diff)
downloadtxr-8b237b2dcd460efb9f15494595bc0b429a76a438.tar.gz
txr-8b237b2dcd460efb9f15494595bc0b429a76a438.tar.bz2
txr-8b237b2dcd460efb9f15494595bc0b429a76a438.zip
* lib.c (partition_by_func): Rename one local variable for clarity.
Remove unessential variable last, and move the next variable into loop scope.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib.c b/lib.c
index 7c65876c..dea60eeb 100644
--- a/lib.c
+++ b/lib.c
@@ -1388,16 +1388,16 @@ val tuples(val n, val seq, val fill)
static val partition_by_func(val env, val lcons)
{
list_collect_decl (out, ptail);
- cons_bind (seq_func, func, env);
- cons_bind (flast, seq_in, seq_func);
+ cons_bind (flast_seq, func, env);
+ cons_bind (flast, seq_in, flast_seq);
val seq = seq_in;
- val last = pop(&seq);
- val next, fnext = nil;
+ val fnext = nil;
- ptail = list_collect(ptail, last);
+ ptail = list_collect(ptail, pop(&seq));
while (seq) {
- fnext = funcall1(func, next = car(seq));
+ val next = car(seq);
+ fnext = funcall1(func, next);
if (!equal(flast, fnext))
break;
@@ -1405,12 +1405,11 @@ static val partition_by_func(val env, val lcons)
ptail = list_collect(ptail, next);
seq = cdr(seq);
- last = next;
flast = fnext;
}
- rplaca(seq_func, fnext);
- rplacd(seq_func, seq);
+ rplaca(flast_seq, fnext);
+ rplacd(flast_seq, seq);
if (seq)
rplacd(lcons, make_lazy_cons(lcons_fun(lcons)));