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

Uploaded Source

Built Distribution

sayori-1.0.5-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for sayori-1.0.5.tar.gz
Algorithm Hash digest
SHA256 0ffd82e53ecd2fce8b3e08076f5b4efedab61cfe293322c8c6327237cf9e1077
MD5 d9f824b8624913407cd4cdd4d1542bd8
BLAKE2b-256 54b18b8467defbf096b1938212b7f24369c8d27c9db5e8a3d37749cbb3458b4d

See more details on using hashes here.

File details

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

File metadata

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

Hashes for sayori-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 38edfb726d98f36386eba535bb782de5c386d3c32943def72167efaed5cba883
MD5 f4114b1d7aee6ef0419d76ba9dedc6e5
BLAKE2b-256 5267de508a817c865086c66f68e9b6f00bb8928581b49938b77ea8ec3696683a

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