# Seittik
Seittik is a functional programming library for Python that aims to
supplant Python's existing functional interfaces, offering a more
comprehensive and expressive alternative.
Put another way: If you ever wished Python's `map`, `filter`, and
`itertools` had a fluent API, or that `lambda` wasn't quite so verbose,
this is for you.
It provides:
- A fluent and extensive API for processing iterable data: *pipes*.
- A compact and expressive alternative to `lambda`: *shears*.
- A kitchen-sink, all-under-one-roof approach.
- A REPL-first philosophy.
## Examples
Something basic:
```python
from seittik import P, X, Y
# Take numbers 1 through 4, triple them, keep evens, and sum them
P([1, 2, 3, 4]).map(X * 3).filter(X % 2 == 0).fold(X + Y)
# 18
# Or, equivalently:
P.range(1, 4).map(X * 3).filter(X % 2 == 0).sum()
# 18
```
And something more amusing:
```python
import random; random.seed(0) # Get a deterministic result below
from seittik import P, X, Y
# Return 5 arrays of traditional RPG stats (rolling three six-sided dice
# for each of "Str", "Dex", "Con", "Int", "Wis", and "Cha") that have at
# least one score of 14 or better, sorted by the sum of the array, in
# descending order, providing dict labels.
(P.roll('3d6')
.chunk(6)
.filter(P.any(X >= 14))
.dictmap({'sum': sum, 'scores': X})
.take(5)
.sort(key=X['sum'], reverse=True)
.list())
# [{'sum': 71, 'scores': (13, 13, 9, 8, 16, 12)},
# {'sum': 66, 'scores': (14, 10, 8, 13, 9, 12)},
# {'sum': 66, 'scores': (8, 14, 9, 12, 13, 10)},
# {'sum': 57, 'scores': (9, 15, 8, 6, 10, 9)},
# {'sum': 54, 'scores': (12, 7, 5, 14, 6, 10)}]
```
(These undoubtedly look much nicer on the [documentation
site](https://seittik.com/).)
## Installation
Using [Poetry](https://python-poetry.org/) with an existing project:
```sh
poetry add seittik
```
If you're using `pip` directly (not recommended):
```sh
pip install seittik
```
## Documentation
See [seittik.com](https://seittik.com/)
## License
MIT. See [LICENSE](./LICENSE).
## Changelog
See [CHANGELOG.md](./CHANGELOG.md).
## Like it? Support kitties!
If you're able, donations to [4 Paws Sake
PA](https://www.facebook.com/4PawsSakePA/) would be enormously
appreciated. They're an absolutely wonderful animal rescue.
("Seittik" is "kitties" spelled backwards. I'm a cat person, and I
wanted to avoid name collisions.)
Raw data
{
"_id": null,
"home_page": "",
"name": "seittik",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "functional,functools,iterable,iteration,iterator,itertools,lambda,pipe,shear",
"author": "Tom Tobin",
"author_email": "opensource@alchemicalhydra.com",
"download_url": "https://files.pythonhosted.org/packages/a0/92/8a5e676f5370cddccdb3c5d46da82ab218091b775d62b7f6d67268adaaf7/seittik-2023.4.tar.gz",
"platform": null,
"description": "# Seittik\n\nSeittik is a functional programming library for Python that aims to\nsupplant Python's existing functional interfaces, offering a more\ncomprehensive and expressive alternative.\n\nPut another way: If you ever wished Python's `map`, `filter`, and\n`itertools` had a fluent API, or that `lambda` wasn't quite so verbose,\nthis is for you.\n\nIt provides:\n\n- A fluent and extensive API for processing iterable data: *pipes*.\n- A compact and expressive alternative to `lambda`: *shears*.\n- A kitchen-sink, all-under-one-roof approach.\n- A REPL-first philosophy.\n\n## Examples\n\nSomething basic:\n\n```python\nfrom seittik import P, X, Y\n\n# Take numbers 1 through 4, triple them, keep evens, and sum them\nP([1, 2, 3, 4]).map(X * 3).filter(X % 2 == 0).fold(X + Y)\n# 18\n\n# Or, equivalently:\nP.range(1, 4).map(X * 3).filter(X % 2 == 0).sum()\n# 18\n```\n\nAnd something more amusing:\n\n```python\nimport random; random.seed(0) # Get a deterministic result below\nfrom seittik import P, X, Y\n\n# Return 5 arrays of traditional RPG stats (rolling three six-sided dice\n# for each of \"Str\", \"Dex\", \"Con\", \"Int\", \"Wis\", and \"Cha\") that have at\n# least one score of 14 or better, sorted by the sum of the array, in\n# descending order, providing dict labels.\n(P.roll('3d6')\n .chunk(6)\n .filter(P.any(X >= 14))\n .dictmap({'sum': sum, 'scores': X})\n .take(5)\n .sort(key=X['sum'], reverse=True)\n .list())\n# [{'sum': 71, 'scores': (13, 13, 9, 8, 16, 12)},\n# {'sum': 66, 'scores': (14, 10, 8, 13, 9, 12)},\n# {'sum': 66, 'scores': (8, 14, 9, 12, 13, 10)},\n# {'sum': 57, 'scores': (9, 15, 8, 6, 10, 9)},\n# {'sum': 54, 'scores': (12, 7, 5, 14, 6, 10)}]\n```\n\n(These undoubtedly look much nicer on the [documentation\nsite](https://seittik.com/).)\n\n## Installation\n\nUsing [Poetry](https://python-poetry.org/) with an existing project:\n\n```sh\npoetry add seittik\n```\n\nIf you're using `pip` directly (not recommended):\n\n```sh\npip install seittik\n```\n\n## Documentation\n\nSee [seittik.com](https://seittik.com/)\n\n## License\n\nMIT. See [LICENSE](./LICENSE).\n\n## Changelog\n\nSee [CHANGELOG.md](./CHANGELOG.md).\n\n## Like it? Support kitties!\n\nIf you're able, donations to [4 Paws Sake\nPA](https://www.facebook.com/4PawsSakePA/) would be enormously\nappreciated. They're an absolutely wonderful animal rescue.\n\n(\"Seittik\" is \"kitties\" spelled backwards. I'm a cat person, and I\nwanted to avoid name collisions.)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A functional programming library that aims to supplant Python's existing functional interfaces, offering a more comprehensive and expressive alternative.",
"version": "2023.4",
"split_keywords": [
"functional",
"functools",
"iterable",
"iteration",
"iterator",
"itertools",
"lambda",
"pipe",
"shear"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "111709b6a3cac03cca84b2cf6cd607d4e4c8d117e5b9a059aa15969c682cb100",
"md5": "6879e7874852d5d946944b6cc53c5733",
"sha256": "001f7a979a38d7b3285d2e5b184acc19a9c8ffc0f88b99893e7aca534adec1d5"
},
"downloads": -1,
"filename": "seittik-2023.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6879e7874852d5d946944b6cc53c5733",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 41519,
"upload_time": "2023-04-07T00:29:20",
"upload_time_iso_8601": "2023-04-07T00:29:20.633919Z",
"url": "https://files.pythonhosted.org/packages/11/17/09b6a3cac03cca84b2cf6cd607d4e4c8d117e5b9a059aa15969c682cb100/seittik-2023.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a0928a5e676f5370cddccdb3c5d46da82ab218091b775d62b7f6d67268adaaf7",
"md5": "1f455733e6906730a158bf294110ae88",
"sha256": "ab44c640d16d9576ef000a8d03075e5b0ac78bf1e387e7286ba810a9413211db"
},
"downloads": -1,
"filename": "seittik-2023.4.tar.gz",
"has_sig": false,
"md5_digest": "1f455733e6906730a158bf294110ae88",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 39223,
"upload_time": "2023-04-07T00:29:22",
"upload_time_iso_8601": "2023-04-07T00:29:22.472016Z",
"url": "https://files.pythonhosted.org/packages/a0/92/8a5e676f5370cddccdb3c5d46da82ab218091b775d62b7f6d67268adaaf7/seittik-2023.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-07 00:29:22",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "seittik"
}