about summary refs log tree commit diff
path: root/solve.py
diff options
context:
space:
mode:
authorEmile <git@emile.space>2023-02-19 14:09:20 +0100
committerEmile <git@emile.space>2023-02-19 14:09:20 +0100
commit85e2e426101fe508fe735833b3014e2aa9d5eedb (patch)
tree1cbfd21ee3ce6702f020eb805fdfb98b4c864578 /solve.py
parent38b74273ba9e9b6f74be9d490d55a27d73681dc4 (diff)
auto update cache.md
Diffstat (limited to 'solve.py')
-rw-r--r--solve.py14
1 files changed, 10 insertions, 4 deletions
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