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.20.tar.gz (8.8 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.20-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oa_utils-0.1.20.tar.gz
  • Upload date:
  • Size: 8.8 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.20.tar.gz
Algorithm Hash digest
SHA256 ffd0ac26cf1efefab41e66257f3d9cec0252d7d9c548c0eb8511d67a6587f1e7
MD5 b4af0c69f68c4e6822acd314d86b112b
BLAKE2b-256 4e61a7a1a35ae1f635ca30759169a452578f2e69592ea763ba75408f26017e6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oa_utils-0.1.20-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.20-py3-none-any.whl
Algorithm Hash digest
SHA256 225e7f8f661d32ff00621601805284aae68cab8977d22738bbc4ca7d59431c3e
MD5 7ba5a02810b701b54955b50a30b283d4
BLAKE2b-256 fb3b14487e8e3ea1227e9bac5977c1ea61465d6e744c1e74885d7a8d7b8ac29f

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