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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oa_utils-0.1.16.tar.gz.
File metadata
- Download URL: oa_utils-0.1.16.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88abc76de75b01d3f19d09b350af6dbbab326260ec7f23ba19c82b8d06909c8a
|
|
| MD5 |
f72ba0ed85634e7bc5916ea73dc57dc3
|
|
| BLAKE2b-256 |
771dcb0eab89b72cde05d3952ca5ca4ead3075402960d06424defac2dc8edbd3
|
File details
Details for the file oa_utils-0.1.16-py3-none-any.whl.
File metadata
- Download URL: oa_utils-0.1.16-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5632ef54eb2dd8fb6bb7002d2688381fd1a8f438cc08fda6838120205251a3a9
|
|
| MD5 |
d653551c35d515491e0d9016d89d87a3
|
|
| BLAKE2b-256 |
0182dca144aac4acca5b76c309cd02ed48c98688ba21df75330534e9717b445e
|