{ "info": { "author": "Jun Namikawa", "author_email": "jnamika@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "pyfunctor is a Python Functor library that provides classes implementing\nlazy evaluation, pipeline operators and block syntax.\n\nAn example of usages is following:\n\n >>> from pyfunctor.functor import *\n >>> f = (Functor(range(10)) >> c_(map)(lambda x: x * 2)\n ... >> c_(filter)(lambda x: x < 7)\n ... >> c_(sorted).key(lambda x: -x))\n >>> run(f) # lazy evaluation\n [6, 4, 2, 0]\n\nThe 'Functor' class packs a value into a context.\nThe pipeline operator '>>' composes functions, but it is not calculated until\n'run' function is applied to the 'Functor' instance.\n\nFurthermore, 'Functor' instance will work together with the 'with' statement.\nThe instance is only once evaluated after the with-block is done.\n\n >>> with Functor(range(10)) as box:\n ... @c_(map)\n ... def f(x):\n ... y = x % 3\n ... z = x + y\n ... return x + y + z\n ...\n ... @c_(sorted, keyword='key')\n ... def g(x):\n ... return (x % 7, x % 3, x)\n >>> box.value\n [0, 14, 8, 16, 10, 18, 4, 12, 6, 20]\n\nIn general, functors are things that can be mapped over, like Lists, Maybes and such.\nThe 'Functor' class implements the identity functor to provide a default implementation.\nAs other examples, 'ListF' and 'Maybe' are provided.\n\n >>> from pyfunctor.list import *\n >>> run(ListF([1, 2, 3]) >> (lambda x: x + 1))\n [2, 3, 4]\n >>> f = lift(lambda x, y: (x, y))\n >>> run(f(ListF(range(3)), ListF('ab')))\n [(0, 'a'), (0, 'b'), (1, 'a'), (1, 'b'), (2, 'a'), (2, 'b')]\n\n >>> from pyfunctor.maybe import *\n >>> @lift\n ... def func(x):\n ... if x > 0: return x * 2\n ... else: raise Exception()\n >>> func(Just(1)).run()\n Just(2)\n >>> func(Just(0)).run()\n Nothing", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jnamika/pyfunctor", "keywords": "functor lazy pipeline block", "license": "ISC License (ISCL)", "maintainer": null, "maintainer_email": null, "name": "pyfunctor", "package_url": "https://pypi.org/project/pyfunctor/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyfunctor/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/jnamika/pyfunctor" }, "release_url": "https://pypi.org/project/pyfunctor/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "A Functor library for Python", "version": "0.1.3" }, "last_serial": 896806, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "fa7248f57e2a7f65ce0e95f7d16e0676", "sha256": "e30f96ff3f0c9f6ea71415e2eaf79b43a3ff2ef7cb0228ea221dcdc36bfae554" }, "downloads": -1, "filename": "pyfunctor-0.1.tar.gz", "has_sig": false, "md5_digest": "fa7248f57e2a7f65ce0e95f7d16e0676", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4857, "upload_time": "2013-09-23T08:59:44", "url": "https://files.pythonhosted.org/packages/38/ec/171671e8878d6e076e39c320ff8c0e3eea1012410622fa4841cc5783a26c/pyfunctor-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "be666d72a2e3d35d16d0d916d06e4809", "sha256": "f2e266558579860629d3455b065afed584bc3ab72199caa1bec45566fd8fd6a6" }, "downloads": -1, "filename": "pyfunctor-0.1.1.tar.gz", "has_sig": false, "md5_digest": "be666d72a2e3d35d16d0d916d06e4809", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3966, "upload_time": "2013-09-23T10:57:09", "url": "https://files.pythonhosted.org/packages/4b/77/7c9f88529558c5bd98e91894cff610439ff823b32402a7364a45c725b6bc/pyfunctor-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "c906a3c75cd55ed82fa8c88cbb615339", "sha256": "346a5f0d76349f4f0a5f33c4349dd2607ee4592e57565a86e8acfee7452e274c" }, "downloads": -1, "filename": "pyfunctor-0.1.2.tar.gz", "has_sig": false, "md5_digest": "c906a3c75cd55ed82fa8c88cbb615339", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3973, "upload_time": "2013-09-23T12:22:02", "url": "https://files.pythonhosted.org/packages/67/08/8ebe9bccdfb7a77f0a3b70a9fb00c0d3bec7506624fa6b9bd1bd5aa8df57/pyfunctor-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "d4c5b277eff55ebe68d61a03a76a00a2", "sha256": "a5fbd45114c40977309d137c0a037cfeceadbeba1f96457981fd53ecd16e9e90" }, "downloads": -1, "filename": "pyfunctor-0.1.3.tar.gz", "has_sig": false, "md5_digest": "d4c5b277eff55ebe68d61a03a76a00a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4122, "upload_time": "2013-10-17T14:57:20", "url": "https://files.pythonhosted.org/packages/70/5d/ceb1db42794ed7ea150f753422bbb6be48930aa7236c4c817518db56f254/pyfunctor-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d4c5b277eff55ebe68d61a03a76a00a2", "sha256": "a5fbd45114c40977309d137c0a037cfeceadbeba1f96457981fd53ecd16e9e90" }, "downloads": -1, "filename": "pyfunctor-0.1.3.tar.gz", "has_sig": false, "md5_digest": "d4c5b277eff55ebe68d61a03a76a00a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4122, "upload_time": "2013-10-17T14:57:20", "url": "https://files.pythonhosted.org/packages/70/5d/ceb1db42794ed7ea150f753422bbb6be48930aa7236c4c817518db56f254/pyfunctor-0.1.3.tar.gz" } ] }