Skip to main content

Make python support function compostion via the matmul operator

Compose

>>> from compose import Compose
>>> @Compose
... def a(x):
...     return x
>>> @Compose
... def b(x):
...     return x + 1
>>> @Compose
... def c(x):
...     return x + 2
>>> (a@b@c)(1)
... 4

Compose and Currying

>>> from compose.operator import *
>>> add % 3
... partial(add, 3)
>>> (add%3@add)(1, 2)
... 6

Pipe adn Stream

>>> [1, 2, 3] | (a@b@c)
... map(a@b@c, [4, 5, 6])
>>> (a@b@c) << [1, 2, 3]
... map(a@b@c, [4, 5, 6])

Release files for fn-compose 1.1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fn-compose 1.1.3.1
File Size Uploaded
fn-compose-1.1.3.1.tar.gz 2.1 kB Details

Release files / fn-compose-1.1.3.1.tar.gz

Download URL fn-compose-1.1.3.1.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9a607800c4a56fc0714a2fd84428076988168dcac5c3f229ed5cc5c8967a64e2
BLAKE2b-256 checksum
How to use checksums
f1c219f58431e75870afa0cb6dc9706a12d887d41900962fc16a621b13e18f6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page