{ "info": { "author": "William Song", "author_email": "songcwzjut@163.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "License :: Public Domain", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "Introduction\n=============\n\nAbstract\n----------\nA cool tool for functional programming. Operating Functions as in math. Type testing is implemented in an awsome way.\n\nKeywords\n----------\nFunctional Programming, Type Testing\n\nFeature:\n\n 1. function with domain, the domain can be used to type testing\n 2. operator on functions, for example, f + g: x -> f(x) + g(x) where f, g, f+g are functions\n 3. to glue functions with glue function or method that can be used to define piecewise functions\n 4. no 3rd part requirement \n 5. implement memoization in oo way.\n 6. use MathFunction for math functions where keyword arguments are deprecated. (new in this version)\n\n\nContent\n=========\n\nClasses::\n\n BaseFunction -> Type (or Domain), Function\n BaseFunction: func: function (or number)\n Function: func,\n domain: Type, the definition domain of func\n\nFunctions::\n\n Interval(a:num, b:num) -> Type\n restrict(t:Type) -> decorator(f:function -> Function(f, t))\n\nConstants::\n\n TURE, FALSE(Type) represent universal set, empty set\n\nGrammar\n=========\n\nBasic grammar\n-------------\n\nimport::\n\n import fcool (or from fcool import *)\n\nDefine Function with domain::\n\n F = Function(lambda x:x, Type(lambda x:x>2))\n F(3)\n\nOperators on Functions::\n\n (F + F)(3)\n (F * F)(4)\n (2 * F)(3)\n\n2D Functions and Types::\n\n f = 3 # or lambda x,y: 3\n g = lambda x,y: 2/x\n t = Type(lambda x:x<5 and isinstance(x, int)) * TRUE # define type(domain) and functions on it\n <=> Type(lambda x, y:x<5) & Type(lambda x, y:isinstance(x, int))\n G = Function(g, t)\n F = Function(f, t)\n\nMemoize::\n\n \n f.memoize() # f is the object of BaseFunction\n f.unmemoize() # prohibit to use memo (memo is not deleted)\n f.del_memo() # just clear the memo, will update the memo in next time\n f.forget() # f.del_memo() and f.unmemoize()\n\n\nAdvanced Grammar\n----------------\n\nGlue Functions::\n\n print(G.glue(F)(3,4), glue(G, F)(3,4)) # glue functions\n\n ID = Function(lambda x:x)\n print(ID.compose(F)(3,4)) # composition\n\nType testing with restrict decorator::\n\n @restrict(Interval(1,2)) # restriction decorator\n def f(x):\n return x\n\n print(f(1))\n try:\n print(f(3))\n except Exception as ex:\n print(ex)\n\n G=Function(lambda x:x)\n print(G(3))\n G = G | Interval(1,2) # restriction method \n print(G(3))", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Freakwill/fcool", "keywords": "Functional Programming,Type Testing", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "fcool", "package_url": "https://pypi.org/project/fcool/", "platform": "", "project_url": "https://pypi.org/project/fcool/", "project_urls": { "Homepage": "https://github.com/Freakwill/fcool" }, "release_url": "https://pypi.org/project/fcool/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "A cool tool for functional programming. Funtions can be operated directly with definition domain that can be used in type testing", "version": "0.1.3" }, "last_serial": 4687706, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "33bd39c0a49e93bfef5f0527e24731ec", "sha256": "22f3e2d32ab068d5a61ea85949d3243859432e59c387071c342eb3003bc4fdf5" }, "downloads": -1, "filename": "fcool-0.1.0.tar.gz", "has_sig": false, "md5_digest": "33bd39c0a49e93bfef5f0527e24731ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2744, "upload_time": "2017-02-05T10:58:56", "url": "https://files.pythonhosted.org/packages/27/10/d1b9339a31f36ed10d43bff6d3ca35c4e3c08c0ac0c020c0a21ae5d2c572/fcool-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "65975502d3e6d455263f17f00ededb81", "sha256": "b310ebaaad4f807cf4ccec7e2385afca7a8ddf6e6ed61200ac2473c43cc1da66" }, "downloads": -1, "filename": "fcool-0.1.1.tar.gz", "has_sig": false, "md5_digest": "65975502d3e6d455263f17f00ededb81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2745, "upload_time": "2017-10-03T06:59:41", "url": "https://files.pythonhosted.org/packages/b8/57/ca99b022300bff04eca50ea2473c564b2ea0c24bdc799fd66f0bd9c27c27/fcool-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "943a96bb266ebf8c110bdf8edc95652c", "sha256": "3c278af6892e8f1fe3e9fd64e746971d4292e91e2e1093af8435d6ca1ad7e7e9" }, "downloads": -1, "filename": "fcool-0.1.2.tar.gz", "has_sig": false, "md5_digest": "943a96bb266ebf8c110bdf8edc95652c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2747, "upload_time": "2018-11-23T11:20:00", "url": "https://files.pythonhosted.org/packages/2e/1e/3ea2c2844a22e8c0a04fb454116851d99e0d3f0f8e2797ebc2eb94e7f27f/fcool-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "1b040f3b99498cb44ec0a99f84b95ec9", "sha256": "98ddc4c6a49c3cfc3a15e35fae8f923219e3c2c75e1f0e6c84b1a4ee31af3398" }, "downloads": -1, "filename": "fcool-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1b040f3b99498cb44ec0a99f84b95ec9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7979, "upload_time": "2019-01-12T03:32:24", "url": "https://files.pythonhosted.org/packages/b8/6f/74702fae31bfc956ecd889e0b051a48353b11cdf41ba198e25eeb3fdafac/fcool-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1b040f3b99498cb44ec0a99f84b95ec9", "sha256": "98ddc4c6a49c3cfc3a15e35fae8f923219e3c2c75e1f0e6c84b1a4ee31af3398" }, "downloads": -1, "filename": "fcool-0.1.3.tar.gz", "has_sig": false, "md5_digest": "1b040f3b99498cb44ec0a99f84b95ec9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7979, "upload_time": "2019-01-12T03:32:24", "url": "https://files.pythonhosted.org/packages/b8/6f/74702fae31bfc956ecd889e0b051a48353b11cdf41ba198e25eeb3fdafac/fcool-0.1.3.tar.gz" } ] }