# Compoz
Compoz is a lightweight composition package.
## Overview
Compoz provides with two main functions:
- composite (for standard composition)
- pipe (for reversed composition)
### 'composite'
'composite' will run from last to the first function provided.
```python
from compoz import composite
def multiply_by_3(n: int) -> int:
return n * 3
def subtract_5(n: int) -> int:
return n - 5
composite_func_1 = composite(subtract_5, multiply_by_3)
print(composite_func_1(10))
# Output will be 25
composite_func_2 = composite(multiply_by_3, subtract_5)
print(composite_func_2(10))
# Output will be 15
```
### 'pipe'
'pipe' will run from first to the last function provided.
```python
from compoz import pipe
def multiply_by_3(n: int) -> int:
return n * 3
def subtract_5(n: int) -> int:
return n - 5
pipe_func_1 = pipe(subtract_5, multiply_by_3)
print(pipe_func_1(10))
# Output will be 15
pipe_func_2 = pipe(multiply_by_3, subtract_5)
print(pipe_func_2(10))
# Output will be 25
```
Raw data
{
"_id": null,
"home_page": "https://github.com/haroldcohen/compoz",
"name": "compoz",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "composition,compose,functional programming",
"author": "Harold Cohen",
"author_email": "me@harold-cohen.com",
"download_url": "https://files.pythonhosted.org/packages/fb/e6/b0fc2dfdb8fd0049d35267f8a8f7b56f63148f12fe6402ed74bc556a1063/compoz-0.1.0b3.tar.gz",
"platform": null,
"description": "# Compoz\n\nCompoz is a lightweight composition package.\n\n## Overview\n\nCompoz provides with two main functions:\n\n- composite (for standard composition)\n- pipe (for reversed composition)\n\n### 'composite'\n\n'composite' will run from last to the first function provided.\n\n```python\nfrom compoz import composite\n\n\ndef multiply_by_3(n: int) -> int:\n return n * 3\n\n\ndef subtract_5(n: int) -> int:\n return n - 5\n\n\ncomposite_func_1 = composite(subtract_5, multiply_by_3)\nprint(composite_func_1(10))\n# Output will be 25\n\ncomposite_func_2 = composite(multiply_by_3, subtract_5)\nprint(composite_func_2(10))\n# Output will be 15\n```\n\n### 'pipe'\n\n'pipe' will run from first to the last function provided.\n\n```python\nfrom compoz import pipe\n\n\ndef multiply_by_3(n: int) -> int:\n return n * 3\n\n\ndef subtract_5(n: int) -> int:\n return n - 5\n\n\npipe_func_1 = pipe(subtract_5, multiply_by_3)\nprint(pipe_func_1(10))\n# Output will be 15\n\npipe_func_2 = pipe(multiply_by_3, subtract_5)\nprint(pipe_func_2(10))\n# Output will be 25\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple composition library",
"version": "0.1.0b3",
"project_urls": {
"Changelog": "https://github.com/haroldcohen/compoz/blob/master/CHANGELOG.md",
"Homepage": "https://github.com/haroldcohen/compoz",
"Issues": "https://github.com/haroldcohen/compoz/issues",
"Repository": "https://github.com/haroldcohen/compoz.git"
},
"split_keywords": [
"composition",
"compose",
"functional programming"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "93b2bac406e24f4345d929b7e0152a5f5d08f8caabd0de2bf133666a10188f1c",
"md5": "e664cad6461b538e8692387991a85741",
"sha256": "2c10e1c62fc77bfd1df67c1511c5369be655f99e56392ac63c0e19f2a41551d0"
},
"downloads": -1,
"filename": "compoz-0.1.0b3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e664cad6461b538e8692387991a85741",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 2768,
"upload_time": "2024-01-05T12:00:21",
"upload_time_iso_8601": "2024-01-05T12:00:21.921393Z",
"url": "https://files.pythonhosted.org/packages/93/b2/bac406e24f4345d929b7e0152a5f5d08f8caabd0de2bf133666a10188f1c/compoz-0.1.0b3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fbe6b0fc2dfdb8fd0049d35267f8a8f7b56f63148f12fe6402ed74bc556a1063",
"md5": "39f6895fcccdf553558423d5a584a7dd",
"sha256": "e880f9117ce6d0929e3286e37e0b5e32ef2866b4bf2752e9721a0998306347a4"
},
"downloads": -1,
"filename": "compoz-0.1.0b3.tar.gz",
"has_sig": false,
"md5_digest": "39f6895fcccdf553558423d5a584a7dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 2329,
"upload_time": "2024-01-05T12:00:23",
"upload_time_iso_8601": "2024-01-05T12:00:23.063388Z",
"url": "https://files.pythonhosted.org/packages/fb/e6/b0fc2dfdb8fd0049d35267f8a8f7b56f63148f12fe6402ed74bc556a1063/compoz-0.1.0b3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-05 12:00:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "haroldcohen",
"github_project": "compoz",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "compoz"
}