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.6.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file sayori-1.0.6.tar.gz
.
File metadata
- Download URL: sayori-1.0.6.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 | 12aece4a53056c019f24c00b63bf83d0720ae49b842c60264c530380bd61e378 |
|
MD5 | 0f71eca9fd466734a69cd4c3c3e93f8b |
|
BLAKE2b-256 | 099d40482445a6270c37a14426edd76ce3988948a78f1ae47dedf4e7db6ac4b8 |
File details
Details for the file sayori-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: sayori-1.0.6-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 | 7f77775a884919cd04143b2534a85d771b0ed3f9a160cbb7afdc52457e69a185 |
|
MD5 | 283e83fee73ee2477188e84b1e99074d |
|
BLAKE2b-256 | 6e3a377d64cd850b5a78639f51d97bbc0ba0b020be52dc93c7dc71aaa0554be5 |