Skip to main content

Statically typed Python utilities for functional programming.

Project description

oa-utils

Statically typed Python utilities for functional programming.

Pipeline

This class is useful for programming in the collection pipeline style. It wraps a homogenous variadic tuple and exposes a fluent interface with common functional programming operations. Why a tuple and not a "lazy" iterator? Because a tuple is relatively immutable and because, in my opinion, reified collections are much easier to reason about than stateful iterators (at the expense of performance).

from oa_utils.pipeline import Pipeline

hamming_distance = (
    Pipeline("karolin") # ('k', 'a', 'r', 'o', 'l', 'i', 'n')
    .zip_with(lambda a, b: int(a != b), "kathrin") # (0, 0, 1, 1, 1, 0, 0)
    .sum() # 3
)

See pipeline.py for docstrings and doctests of every method.

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

oa_utils-0.1.19.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oa_utils-0.1.19-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file oa_utils-0.1.19.tar.gz.

File metadata

  • Download URL: oa_utils-0.1.19.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.1 Windows/10

File hashes

Hashes for oa_utils-0.1.19.tar.gz
Algorithm Hash digest
SHA256 61804ed8243db6e122b14f6ed61ec4ba42355d089ec13a546cb9eeef46dc5f13
MD5 513b09309b1dfd6be816d254975e35d4
BLAKE2b-256 c8448b9c98e78d5553f5dd7b7c9dd3d20e28bf33cfcde6f010a6846e64838aa5

See more details on using hashes here.

File details

Details for the file oa_utils-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: oa_utils-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.1 Windows/10

File hashes

Hashes for oa_utils-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 813b5aa579ae0024b285b5d80f45a56d3ea3ab52b5dfebd60479eb9348a0ffbf
MD5 7343828359a1d7236e7fb8563b995075
BLAKE2b-256 2e22caa0a9e28b976c0bc1d08f81f0fd4b5553d3539329951912e6a07157556d

See more details on using hashes here.

Supported by

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