Skip to main content

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.2.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

sayori-1.0.2-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file sayori-1.0.2.tar.gz.

File metadata

  • Download URL: sayori-1.0.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for sayori-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d6dacfbad6cdeb68a324850a6df45fb144799f26b83834dc51fda13aac97d197
MD5 d4acaea27824b580faae2a64707a4eda
BLAKE2b-256 672b2995ed2adee3014a5fc289b88ec89f4484c6bad056d44f41b5f9639cdaf1

See more details on using hashes here.

File details

Details for the file sayori-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sayori-1.0.2-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

Hashes for sayori-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e456536d195f68056a51b1cd74fcc2cf42ee557d0d332725d1a0125d247984e7
MD5 e0dfa3e6ed04be755fe99c5e5bd5249e
BLAKE2b-256 4df04e9d578f38453bb6bf3a20f968e1fd061bdaf2e3fd1c4c001f587fa2e344

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page