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.4.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file sayori-1.0.4.tar.gz
.
File metadata
- Download URL: sayori-1.0.4.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 260e15ff627d0e8a478d03e90b9b5dae96ab3fdf20c92f1cb435fb9eaae73c54 |
|
MD5 | 03269a341178599c4f46b56f08c157e0 |
|
BLAKE2b-256 | 728949df77c3502a025fbfd4be5e9b140ca128df8c4f832cc8832344ef8fe8d8 |
File details
Details for the file sayori-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: sayori-1.0.4-py3-none-any.whl
- Upload date:
- Size: 2.8 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 | 8e77ab1d0ac5b4054ebeda6a5fe07f39816470e6bdd8936650bd6337104e6ec0 |
|
MD5 | 9e66dba37f6700d99b12ce6cfdd48496 |
|
BLAKE2b-256 | be503d648b40a18e4c9fced2162b4778076bf479659fd592441f020e49bedb94 |