semvec/pypi-packages huggingface dataset:
curryparty 0.4.3
Python playground to learn lambda calculus
Requires Python: >=3.13

<p align="center">
  <img src="https://github.com/rambip/curryparty/blob/main/logo.svg?raw=true" width="500px"/>
</p>


# 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

```python
from curryparty import L, o

# Build classic lambda calculus expressions

# Identity: λx. x
identity = L("x").o("x").build()

# Const (K combinator): λx. λy. x
const = L("x", "y").o("x").build()

# Omega: λx. x x
omega = L("x").o("x", "x").build()
print(omega(omega))  # (λ0 x0(x0))((λ1 x1(x1)))

# Church numerals
zero = L("f", "x").o("x").build()
one = L("f", "x").o("f", "x").build()
two = L("f", "x").o("f", o("f", "x")).build()

succ = L("n", "f", "x").o("f", o("n", "f", "x")).build()

# S combinator: λf. λg. λx. f x (g x)
s_comb = L("f", "g", "x").o("f", "x", o("g", "x")).build()

# Beta reduction
# Nothing happens until you reduce:
app = identity(identity)
print(app)  # (λ0 x0)((λ1 x1))

# Perform one reduction step:
reduced = app.beta()
print(reduced)  # λ0 x0

# Multiple reductions:
term = succ(zero)
print(f"Steps: {len(list(term.reduction_chain()))}")  # Steps: 3

# Print each step:
for step in term.reduction_chain():
    print(step)

# Or get the final result directly:
result = succ(zero).reduce()
print(result)  # λ0 λ1 x0(x1) (i.e, one)
```

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:

<img width="1140" height="440" alt="notebook_display" src="https://github.com/user-attachments/assets/6ac48738-eb58-4f7c-908f-567a855f37f5" />



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:

[![Open with marimo](https://marimo.io/shield.svg)](https://marimo.app/github.com/rambip/curryparty/blob/main/lambda.py)

# 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](https://github.com/pola-rs/polars) dataframe in prefix traversal order.
If you want to understand how it works, start by looking at the `.nodes` attribute of any term.
utils4 1.8.2
A general utilities package for Python 3.10+.
Requires Python: >=3.10
Keywords: library, utility, utilities


# A general utilities package for Python 3.10+

[![PyPI - Version](https://img.shields.io/pypi/v/utils4?style=flat-square)](https://pypi.org/project/utils4)
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/utils4?style=flat-square)](https://pypi.org/project/utils4)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/utils4?style=flat-square)](https://pypi.org/project/utils4)
[![PyPI - Status](https://img.shields.io/pypi/status/utils4?style=flat-square)](https://pypi.org/project/utils4)
[![Static Badge](https://img.shields.io/badge/tests-passing-brightgreen?style=flat-square)](https://pypi.org/project/utils4)
[![Static Badge](https://img.shields.io/badge/code_coverage-100%25-brightgreen?style=flat-square)](https://pypi.org/project/utils4)
[![Static Badge](https://img.shields.io/badge/pylint_analysis-100%25-brightgreen?style=flat-square)](https://pypi.org/project/utils4)
[![Documentation Status](https://readthedocs.org/projects/utils4/badge/?version=latest&style=flat-square)](https://utils4.readthedocs.io/en/latest/)
[![PyPI - License](https://img.shields.io/pypi/l/utils4?style=flat-square)](https://opensource.org/licenses/MIT)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/utils4?style=flat-square)](https://pypi.org/project/utils4)

The ``utils4`` project is a CPython and C library which contains generalised, utility-based functions, designed to be an underlying library across your various Python 3.10+ projects.


## Installation
The easiest way to install ``utils4`` is using `pip` *after* activating your virtual environment:

```
pip install utils4
```

## Toolset
Listed below are *some* of the project's commonly used tools and utilities. Some of these items are utilities unto themselves, while others are simple convenience wrappers around existing libraries, just brought together for convenience.

- Colour maps
- Converters (e.g. binary, hexadecimal, ASCII and integer)
- Cryptographic and hashing functions
- Error reporting
- General maths-based functionality (e.g. for solving [Project Euler](https://projecteuler.net/) problems)
- General utility functions
- Logging
- Progress bar
- Terminal colour handling
- Terminal user interface styling 
- Wait ticker / spinner
- etc.


## Using the Library
The [documentation suite](https://utils4.readthedocs.io/en/latest/index.html) contains usage examples and detailed explanation for each of the library's importable modules. Please refer to the [Library API Documentation](https://utils4.readthedocs.io/en/latest/library.html#library-api) section of the documentation.


## Additional Information
As the library contains some C components, building on Windows may prove tricky.  To help address this, we've pre-compiled some `win_amd64` wheels for you. These wheels are available on [GitHub's Releases page](https://github.com/s3dev/utils4/releases), for each release.