From 85e2e426101fe508fe735833b3014e2aa9d5eedb Mon Sep 17 00:00:00 2001 From: Emile Date: Sun, 19 Feb 2023 14:09:20 +0100 Subject: auto update cache.md --- solve.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'solve.py') diff --git a/solve.py b/solve.py index 60ae42c..06daab1 100644 --- a/solve.py +++ b/solve.py @@ -198,8 +198,9 @@ def beta_reduce(depth, expression): # move lambdas from body to params if "λ" in body: idx = body.index("λ") - params.append(body[idx+1]) - del body[idx:idx+3] # the lambda, the arg and the dot + if body[idx-1] != "(": + params.append(body[idx+1]) + del body[idx:idx+3] # the lambda, the arg and the dot # +++++++++++++ THIS COULD BE BROKEN ++++++++ @@ -664,8 +665,13 @@ while True: pickle.dump(cache, handle, protocol=pickle.HIGHEST_PROTOCOL) for k in cache: - #print(k, cache[k]) - print(k) + + cache_human_readable = open("cache.md", "w") + cache_human_readable.write(f"# cache\n```\n") + for k in cache: + cache_human_readable.write(f"{k}: {cache[k]}\n") + print(k) + cache_human_readable.write(f"```") break -- cgit 1.4.1