Compose functions using pipeline notation.
Project description
Sayori
Sayori is a tiny library for composing pure functions using pipeline notation. If f
and g
are functions then f | g
is a function such that (f | g)(x) = g(f(x))
.
Installation
pip install sayori
Usage
Sayori exports a simple decorator called Composable
which implements the pipe operator. It can be used as follows:
from sayori import Composable
Create two composable functions...
f = Composable(lambda x: x + 1)
g = Composable(lambda x: x * 2)
Compose them...
h = f | g
Apply the composite...
h(2) # returns 6
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sayori-1.0.1.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file sayori-1.0.1.tar.gz
.
File metadata
- Download URL: sayori-1.0.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8e1d993b4122de3fbda7cc8a924f14a7a5bf5e0c8642104dda74b458d5853f6 |
|
MD5 | 8a997b5944a33ab4dfbf9d20dc3cfd90 |
|
BLAKE2b-256 | 1cf4e3ac96d0138bdff24d633bf14c9da82d116225d5edc989ff69cd8fffc2a0 |
File details
Details for the file sayori-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: sayori-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03983194774efcf2b9de0403e4c9daf65902d2157de95b025685afe96a7ad614 |
|
MD5 | 4bb3c6abc2207d2d6c5f564d66021439 |
|
BLAKE2b-256 | 579952c62f0bfed7141f745684199d679cb22715326f76206a62ced04bfc31ce |