summaryrefslogtreecommitdiffstats
path: root/combi.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-12-27 17:08:53 -0800
committerKaz Kylheku <kaz@kylheku.com>2023-12-27 17:08:53 -0800
commitca00aa3dc10a0d450106f0342a8506f5f416a5a0 (patch)
treeac6412a2ed9e2a31789b39b9bd30c19cb589c45b /combi.c
parent36fdbc7a4791ffdedf0658eb69963cffe08aaee1 (diff)
downloadtxr-ca00aa3dc10a0d450106f0342a8506f5f416a5a0.tar.gz
txr-ca00aa3dc10a0d450106f0342a8506f5f416a5a0.tar.bz2
txr-ca00aa3dc10a0d450106f0342a8506f5f416a5a0.zip
comb: eliminate comb_hash_while_fun.
* combi.c (comb_hash_while_fun): Function removed. (comb_hash): For the while function, use the unwrapped state, and just comb_while_fun. The augmented state with hash is used only with comb_hash_gen_fun.
Diffstat (limited to 'combi.c')
-rw-r--r--combi.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/combi.c b/combi.c
index b20555ae..79f65f2a 100644
--- a/combi.c
+++ b/combi.c
@@ -502,11 +502,6 @@ static val comb_str(val str, val k)
func_f0(state, comb_str_gen_fun));
}
-static val comb_hash_while_fun(val state)
-{
- return car(car(state));
-}
-
static val comb_hash_gen_fun(val hstate)
{
val self = lit("comb");
@@ -524,11 +519,11 @@ static val comb_hash_gen_fun(val hstate)
return out;
}
-
static val comb_hash(val hash, val k)
{
- val hstate = cons(comb_init(hash_alist(hash), k), hash);
- return generate(func_f0(hstate, comb_hash_while_fun),
+ val state = comb_init(hash_alist(hash), k);
+ val hstate = cons(state, hash);
+ return generate(func_f0(state, comb_while_fun),
func_f0(hstate, comb_hash_gen_fun));
}