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 hashes)
Built Distribution
sayori-1.0.6-py3-none-any.whl
(2.8 kB
view hashes)