{ "info": { "author": "Christoforus Surjoputro", "author_email": "cs_sanmar@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "=============\ncpyfunctional\n=============\n:Author: Christoforus Surjoputro \n:Date: $Date: 2018-12-31 $\n:Version: $Version: 0.0.1 $\n:License: MIT License\n\n.. role:: python(code)\n :language: python\n\n.. image:: https://travis-ci.org/3mp3ri0r/cpyfunctional.svg?branch=master\n :target: https://travis-ci.org/3mp3ri0r/cpyfunctional\n\n.. image:: https://codecov.io/gh/3mp3ri0r/cpyfunctional/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/3mp3ri0r/cpyfunctional\n\n.. contents:: Table of content\n\nIntroduction\n============\n\n`cpyfunctional`_ is python package to help you code python in functional programming paradigm. `Series of article`_ by\nEric Elliot will tell you why you should code using functional programming.\n\nPython version\n--------------\n\nThis module work on 3.4+. Fully tested on python 3.5.2.\n\nHow to install\n==============\n\n.. code-block:: bash\n\n pip install cpyfunctional\n\nHow to use\n==========\n\n1. Import cpyfunctional to your project: :python:`import cpyfunctional`.\n2. Choose action you want in :python:`cpyfunctional` package.\n\ncompose\n-------\n\n`compose`_ is a function to execute any callable one by one chaining from last callable to first. This function accept\nany callable and execute it from last callable to the first and pass every result to next callable until the last.\n\n.. code-block:: python\n\n def inc(number: int) -> int:\n return number + 1\n\n def square(number: int) -> int:\n return number ** 2\n\n cpyfunctional.compose(inc, square)(3) # 10\n cpyfunctional.compose(square, inc)(3) # 16\n\nAs you can see, it execute callable from last to first. You can also use lambda instead of creating function.\n\n.. code-block:: python\n\n cpyfunctional.compose(lambda number: number + 1, lambda number: number ** 2)(3) # 10\n\npipe\n----\n\nThis function has same functionality to `compose`_ but execute callable from first to last.\n\n.. code-block:: python\n\n def inc(number: int) -> int:\n return number + 1\n\n def square(number: int) -> int:\n return number ** 2\n\n cpyfunctional.pipe(inc, square)(3) # 16\n cpyfunctional.pipe(square, inc)(3) # 10\n\nfunc_curry\n----------\n\n`func_curry`_ is a function to add parameter to callable that called by `compose`_ or `pipe`_. This function accept a\ncallable that accept parameter and push previous value to related callable and execute it.\n\n.. code-block:: python\n\n def inc(number: int) -> int:\n return number + 1\n\n def multiple(multiplier: int, prev_number: int) -> int:\n return prev_number * multiplier\n\n cpyfunctional.compose(inc, func_curry(multiple)(6))(3) # 19\n\nThis example show that now callable are able to accept any parameter not only from previous result.\n\nHow to contribute\n=================\n\nJust create an `issue`_ when you encounter any problem or contact me personally.\n\n.. _`cpyfunctional`: https://gitlab.com/3mp3ri0r/cpyfunctional\n.. _`Series of article`: https://medium.com/javascript-scene/composing-software-an-introduction-27b72500d6ea\n.. _`issue`: https://gitlab.com/3mp3ri0r/cpyfunctional/issues\n\nNote\n====\n\nI'm not an expert in functional programming, so any input about FP like any function and/or naming and/or incorrect\nimplementation will be very helpful.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/3mp3ri0r/cpyfunctional/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Cpyfunctional", "package_url": "https://pypi.org/project/Cpyfunctional/", "platform": "any", "project_url": "https://pypi.org/project/Cpyfunctional/", "project_urls": { "Homepage": "https://github.com/3mp3ri0r/cpyfunctional/" }, "release_url": "https://pypi.org/project/Cpyfunctional/0.0.2/", "requires_dist": [ "typing ; python_version < \"3.5\"", "coverage ; extra == 'dev'", "mypy ; extra == 'dev'" ], "requires_python": "~=3.4", "summary": "A python package to help you code python in functional programming paradigm.", "version": "0.0.2" }, "last_serial": 4649436, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ddd7e0432a4759e41f4ee18cc460914c", "sha256": "4dd75e4d443195ab49cced13a54d74ed2c70e29804499ef7ebac7ed5b1708984" }, "downloads": -1, "filename": "Cpyfunctional-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ddd7e0432a4759e41f4ee18cc460914c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 4257, "upload_time": "2018-12-31T21:20:26", "url": "https://files.pythonhosted.org/packages/7b/1e/5b1fff7e402094015ec1de0fb493658bb69b003d9d4e66283d5b3a7cddcf/Cpyfunctional-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cef7ec33ebf80f400c750852ba279c61", "sha256": "cd8f476472cca9d707283d71948603d6208857d622856801479245688f18fe34" }, "downloads": -1, "filename": "Cpyfunctional-0.0.1.tar.gz", "has_sig": false, "md5_digest": "cef7ec33ebf80f400c750852ba279c61", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.4", "size": 3369, "upload_time": "2018-12-31T21:20:27", "url": "https://files.pythonhosted.org/packages/64/a9/9c04b8bf4b6e965682f18d62a4828425e76ba5b3892a18a939b2865c68f3/Cpyfunctional-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "a2253282e94e2a64861fbac17fbe7683", "sha256": "99acfcf6017228399cb9c9e86567982c69e29232e00d8f4a88bd44b65b3344e5" }, "downloads": -1, "filename": "Cpyfunctional-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "a2253282e94e2a64861fbac17fbe7683", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 4270, "upload_time": "2019-01-01T03:45:42", "url": "https://files.pythonhosted.org/packages/bc/b0/3a2b9f988308e6ba8a82be2eec8374e27494b09353c96ae620fa107d4391/Cpyfunctional-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "292f9c7fca1fd55563fd152a90948a5e", "sha256": "844bfe2bd98a725d8e9ffd859839c9c560bf18e35ef91396fa409c84d3a4ff36" }, "downloads": -1, "filename": "Cpyfunctional-0.0.2.tar.gz", "has_sig": false, "md5_digest": "292f9c7fca1fd55563fd152a90948a5e", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.4", "size": 3291, "upload_time": "2019-01-01T03:45:43", "url": "https://files.pythonhosted.org/packages/f7/ac/fa93f78aea97e8509ed1bbc37f06a7743b396493d3cbe1613a989041a7da/Cpyfunctional-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a2253282e94e2a64861fbac17fbe7683", "sha256": "99acfcf6017228399cb9c9e86567982c69e29232e00d8f4a88bd44b65b3344e5" }, "downloads": -1, "filename": "Cpyfunctional-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "a2253282e94e2a64861fbac17fbe7683", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.4", "size": 4270, "upload_time": "2019-01-01T03:45:42", "url": "https://files.pythonhosted.org/packages/bc/b0/3a2b9f988308e6ba8a82be2eec8374e27494b09353c96ae620fa107d4391/Cpyfunctional-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "292f9c7fca1fd55563fd152a90948a5e", "sha256": "844bfe2bd98a725d8e9ffd859839c9c560bf18e35ef91396fa409c84d3a4ff36" }, "downloads": -1, "filename": "Cpyfunctional-0.0.2.tar.gz", "has_sig": false, "md5_digest": "292f9c7fca1fd55563fd152a90948a5e", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.4", "size": 3291, "upload_time": "2019-01-01T03:45:43", "url": "https://files.pythonhosted.org/packages/f7/ac/fa93f78aea97e8509ed1bbc37f06a7743b396493d3cbe1613a989041a7da/Cpyfunctional-0.0.2.tar.gz" } ] }