Skip to main content

Make python support function compostion via the matmul operator

Project description

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])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fn-compose, version 1.1.2b3
Filename, size File type Python version Upload date Hashes
Filename, size fn-compose-1.1.2b3.tar.gz (1.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page