Python playground to learn lambda calculus
Project description
Curry party
curryparty is a library created to explore, visualize and teach lambda-calculus concepts.
Install
Run pip install curryparty or uv add curryparty depending on your package manager.
How to use
from curryparty import L, V
# build expressions idiomatically
identity = L("x")._("x").build()
zero = L("f", "x")._("x").build()
omega = L("x")._("x").call("x").build()
# you can create more complex terms:
succ = L("n", "f", "x")._("f").call(
V("n").call("f").call("x")
)
# If you try to combine them, nothing will happen:
bomb = omega(omega)
one = s(zero)
# You need to beta-reduce them:
bomb.beta()
one_with_first_reduction = one.beta()
# if you want the final form:
term = s(zero)
while term is not None:
term = term.beta()
print(term)
# this is equivalent to:
for x in term.reduction_chain():
print(x)
But the main point of this library is the svg-based display system. If you use a notebook such as jupyternotebook or marimo, you will see something like this:
You can also use term.show_reduction to get an animated version.
Tutorial
lambda.py shows a tutorial in marimo format. Click on the button to try it out:
How it works
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).
For efficiency, they are converted to a polars dataframe in prefix traversal order.
If you want to understand how it works, start by looking at the .nodes attribute of any term.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file curryparty-0.3.2.tar.gz.
File metadata
- Download URL: curryparty-0.3.2.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c57c4682f6da983db5422f66ce0acc4aaaf615160f22e03640faa02e942de8a
|
|
| MD5 |
2f1804f17d00cfa323cbc9cc73e6199c
|
|
| BLAKE2b-256 |
c7f39575232b0e71a4214d2237c6ec73fd66a1e628e0049c8adb3cf4ab20bbf8
|
Provenance
The following attestation bundles were made for curryparty-0.3.2.tar.gz:
Publisher:
publish.yml on rambip/curryparty
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
curryparty-0.3.2.tar.gz -
Subject digest:
7c57c4682f6da983db5422f66ce0acc4aaaf615160f22e03640faa02e942de8a - Sigstore transparency entry: 915750152
- Sigstore integration time:
-
Permalink:
rambip/curryparty@8982a15c6b6245af8273ac24fe5bed3d47052384 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/rambip
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8982a15c6b6245af8273ac24fe5bed3d47052384 -
Trigger Event:
push
-
Statement type:
File details
Details for the file curryparty-0.3.2-py3-none-any.whl.
File metadata
- Download URL: curryparty-0.3.2-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
355fa5b9165f062cbbb8cc8c32c59b436c6a1ae6be8a753f67cf6bb0fe40bcb1
|
|
| MD5 |
99a6043de5392df06ec6f92745f93c4e
|
|
| BLAKE2b-256 |
f2ecf3fd791c75a508d41bd604c2d7e45e3c552d8b6468f100466c0bf1d994a3
|
Provenance
The following attestation bundles were made for curryparty-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on rambip/curryparty
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
curryparty-0.3.2-py3-none-any.whl -
Subject digest:
355fa5b9165f062cbbb8cc8c32c59b436c6a1ae6be8a753f67cf6bb0fe40bcb1 - Sigstore transparency entry: 915750223
- Sigstore integration time:
-
Permalink:
rambip/curryparty@8982a15c6b6245af8273ac24fe5bed3d47052384 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/rambip
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8982a15c6b6245af8273ac24fe5bed3d47052384 -
Trigger Event:
push
-
Statement type: