From ca00aa3dc10a0d450106f0342a8506f5f416a5a0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 27 Dec 2023 17:08:53 -0800 Subject: 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. --- combi.c | 11 +++-------- 1 file 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)); } -- cgit v1.2.3