curryparty 0.1.1__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {curryparty-0.1.1 → curryparty-0.2.0}/PKG-INFO +7 -1
- {curryparty-0.1.1 → curryparty-0.2.0}/README.md +6 -0
- {curryparty-0.1.1 → curryparty-0.2.0}/pyproject.toml +1 -1
- {curryparty-0.1.1 → curryparty-0.2.0}/src/curryparty/__init__.py +7 -1
- {curryparty-0.1.1 → curryparty-0.2.0}/src/curryparty/core.py +0 -0
- {curryparty-0.1.1 → curryparty-0.2.0}/src/curryparty/display.py +0 -0
- {curryparty-0.1.1 → curryparty-0.2.0}/src/curryparty/py.typed +0 -0
- {curryparty-0.1.1 → curryparty-0.2.0}/src/curryparty/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: curryparty
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Python playground to learn lambda calculus
|
|
5
5
|
Author: Antonin P
|
|
6
6
|
Author-email: Antonin P <antonin.peronnet@telecom-paris.fr>
|
|
@@ -62,6 +62,12 @@ If you use a notebook such as jupyternotebook or marimo, you will see something
|
|
|
62
62
|
|
|
63
63
|
You can also use `term.show_reduction` to get an animated version.
|
|
64
64
|
|
|
65
|
+
# Tutorial
|
|
66
|
+
|
|
67
|
+
`lambda.py` shows a tutorial in marimo format. Click on the button to try it out:
|
|
68
|
+
|
|
69
|
+
[](https://marimo.app/github.com/rambip/curryparty/blob/main/lambda.py)
|
|
70
|
+
|
|
65
71
|
# How it works
|
|
66
72
|
|
|
67
73
|
Under the wood, all the terms are converted into a list of nodes, that can either be a `lambda`, an `application` (with 2 arguments) or a `variable` (with 0 arguments).
|
|
@@ -52,6 +52,12 @@ If you use a notebook such as jupyternotebook or marimo, you will see something
|
|
|
52
52
|
|
|
53
53
|
You can also use `term.show_reduction` to get an animated version.
|
|
54
54
|
|
|
55
|
+
# Tutorial
|
|
56
|
+
|
|
57
|
+
`lambda.py` shows a tutorial in marimo format. Click on the button to try it out:
|
|
58
|
+
|
|
59
|
+
[](https://marimo.app/github.com/rambip/curryparty/blob/main/lambda.py)
|
|
60
|
+
|
|
55
61
|
# How it works
|
|
56
62
|
|
|
57
63
|
Under the wood, all the terms are converted into a list of nodes, that can either be a `lambda`, an `application` (with 2 arguments) or a `variable` (with 0 arguments).
|
|
@@ -41,6 +41,12 @@ class Term:
|
|
|
41
41
|
reduced = beta_reduce(self.nodes, lamb, b)
|
|
42
42
|
return Term(reduced)
|
|
43
43
|
|
|
44
|
+
def reduce(self):
|
|
45
|
+
last_non_reduced = self
|
|
46
|
+
for term in self.reduction_chain():
|
|
47
|
+
last_non_reduced = term
|
|
48
|
+
return last_non_reduced
|
|
49
|
+
|
|
44
50
|
def reduction_chain(self) -> Iterable["Term"]:
|
|
45
51
|
term = self
|
|
46
52
|
while True:
|
|
@@ -49,7 +55,7 @@ class Term:
|
|
|
49
55
|
if term is None:
|
|
50
56
|
break
|
|
51
57
|
|
|
52
|
-
def
|
|
58
|
+
def show_beta(self):
|
|
53
59
|
candidates = find_redexes(self.nodes)
|
|
54
60
|
if len(candidates) == 0:
|
|
55
61
|
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|