{ "info": { "author": "Baptiste Fontaine", "author_email": "b@ptistefontaine.fr", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# clj\n\n`clj` is a Python module for those times when you did too much Clojure and\ncame back to Python thinking where are all these `distinct`, `drop-while`,\n`cycle`, `first`, etc.\n\n## Install\n\n pip install clj\n\n## Usage\n\n### Example\n\n```clojure\n;; Clojure\n(println (count (distinct (filter even? (map inc coll)))))\n```\n\n```python\n# Python\nfrom clj import count, distinct, filter, inc, map\n\neven = lambda e: ~e&1\n\nprint(count(distinct(filter(even, map(inc, coll)))))\n```\n\nNote that `count()` works on both sequences in generators; in the latter case\nit doesn\u2019t load everything in memory like e.g. `len(list(g))` would do.\n\n## Core Ideas\n\n* Lazy by default. All functions should work on arbitrary iterators and\n return generators.\n* This is Python. We keep Python\u2019s semantics instead of trying to reproduce\n Clojure in Python (e.g. `0` and `[]` are logically true in Clojure but false\n in Python; `None` is not equivalent to an empty collection).\n* Don\u2019t Reinvent the Wheel. We don\u2019t reimplement built-in functions\n unless they miss something: `range` because it can\u2019t be called without\n argument to yield an infinite sequence; `map` and `filter` in Python 2\n because they aren\u2019t lazy.\n\n## Support\n\nThe general naming scheme is: use underscores instead of hyphens; start the\nfunction with `is_` if its Clojure counterparts ends with a `?`.\n\n### Sequences\n\nWe aim to implement all Clojure functions that operate on sequences\n(see [the list here][seqs]).\nThey all work on iterables and return generators by default (Python\u2019s closest\nequivalent of lazy seqs). We don\u2019t support transducers.\n\n[seqs]: http://clojure.org/reference/sequences\n\n| Clojure | `clj` | Comment |\n|-------------------|:----------------|----------------------------------|\n| `distinct` | `distinct` | |\n| `filter` | `filter` | |\n| `remove` | `remove` | |\n| `keep` | `keep` | |\n| `keep-indexed` | `keep_indexed`\u00a0 | |\n| `cons` | `cons` | |\n| `concat` | `concat` | Deprecated. Use Python\u2019s `itertools.chain` |\n| `lazy-cat` | - | Use Python\u2019s `itertools.chain` |\n| `mapcat` | `mapcat` | |\n| `cycle` | `cycle` | |\n| `interleave` | `interleave` | |\n| `interpose` | `interpose` | |\n| `rest` | `rest` | |\n| `next` | - | Use `rest`. |\n| `fnext` | - | Use `second`. |\n| `nnext` | - | Use `rest(rest(\u2026))` |\n| `drop` | `drop` | |\n| `drop-while` | `drop_while` | Deprecated. Use Python\u2019s `itertools.dropwhile` |\n| `nthnext` | - | Use `drop`. |\n| `take` | `take` | |\n| `take-nth` | `take_nth` | |\n| `take-while` | `take_while` | Deprecated. Use Python\u2019s `itertools.takewhile` |\n| `butlast` | `butlast` | |\n| `drop-last` | `drop_last` | |\n| `flatten` | `flatten` | |\n| `reverse` | - | Use Python\u2019s `reversed`. |\n| `sort` | - | Use Python\u2019s built-in `sort`. |\n| `sort-by` | - | Use `sort(\u2026, key=your_function)`.|\n| `shuffle` | `shuffle` | |\n| `split-at` | `split_at` | |\n| `split-with` | `split_with` | |\n| `partition` | \u00a0 | |\n| `partition-all` | \u00a0 | |\n| `partition-by` | \u00a0 | |\n| `map` | `map` | |\n| `pmap` | - | |\n| `replace` | `replace` | |\n| `reductions` | `reductions` | `(reductions f i c)` becomes `reductions(f, c, i)` |\n| `map-indexed` | `map_indexed` | |\n| `seque` | - | |\n| `first` | `first`\u00a0 | |\n| `ffirst` | `ffirst` | |\n| `nfirst` | `nfirst` | |\n| `second` | `second` | |\n| `nth` | `nth` | |\n| `last` | `last` | |\n| `rand-nth` | - | Use Python\u2019s `random.choice`. |\n| `zipmap` | `zipmap` | |\n| `into` | - | |\n| `reduce` | - | Use Python\u2019s built-in `reduce`. |\n| `set` | - | Use Python\u2019s `set`. |\n| `vec` | - | Use Python\u2019s `list`. |\n| `into-array` | - | Use Python\u2019s `list`. |\n| `to-array-2d` | - | |\n| `frequencies` | - | Use Python\u2019s `collections.Counter`.|\n| `group-by` | `group_by` | |\n| `apply` | - | Use the `f(*args)` construct. |\n| `not-empty` | - | |\n| `some` | `some` | |\n| `seq?` | `is_seq` | |\n| `every?` | `every` | |\n| `not-every?` | `not_every` | |\n| `not-any?` | `not_any` | |\n| `empty?` | - | |\n| `empty` | `empty` | |\n| `doseq` | - | Use `for \u2026 in`. |\n| `dorun` | `dorun` | |\n| `doall` | - | Use Python\u2019s `list`. |\n| `realized?` | - | |\n| `seq` | - | |\n| `vals` | - | Use Python\u2019s `dict.values`. |\n| `keys` | - | Use Python\u2019s `dict.keys`. |\n| `rseq` | - | |\n| `subseq` | \u00a0 | |\n| `rsubseq` | \u00a0 | |\n| `repeatedly` | `repeatedly` | |\n| `iterate` | `iterate` | |\n| `repeat` | `repeat` | `(repeat n x)` becomes `repeat(x, n)`.|\n| `range` | `range` | Prefer Python\u2019s `range` for everything but infinite generators.|\n| `line-seq` | - | Loop over an `io.BufferedReader`.|\n| `resultset-seq` | - | |\n| `re-seq` | - | Use Python\u2019s `re.finditer`. |\n| `tree-seq` | `tree_seq` | |\n| `file-seq` | - | Use Python\u2019s `os.walk`. |\n| `xml-seq` | - | |\n| `iterator-seq` | - | |\n| `enumeration-seq` | - | |\n| `hash-map` | - | Use Python\u2019s `dict`. |\n| `array-map` | - | Use Python\u2019s `dict`. |\n| `sorted-map` | - | Use `collections.OrderedDict`. |\n| `sorted-map-by` | | |\n| `hash-set` | - | Use Python\u2019s `set`. |\n| `set` | - | Use Python\u2019s `set`. |\n| `sorted-set` | | |\n| `sorted-set-by` | | |\n| `dedupe` | | |\n\nWe also implemented `count`, which uses Python\u2019s `len` when possible and\nfallbacks on a `for` loop for other cases.\n\n### Functions\n\nWe also provide miscellaneous functions as well as functions that work on\nfunctions.\n\n| Clojure | `clj` | Comment |\n|-------------------|:----------------|----------------------------------|\n| `identity` | `identity` | |\n| `partial` | - | Use Python\u2019s `functools.partial` |\n| `comp` | `comp` | |\n| `complement` | `complement` | |\n| `constantly` | `constantly` | |\n| `juxt` | `juxt` | |\n| `distinct?` | `is_distinct` | |\n\n| Clojure | `clj` | Comment |\n|-------------------|:----------------|----------------------------------|\n| `inc` | `inc` | |\n| `dec` | `dec` | |\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bfontaine/clj", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "clj", "package_url": "https://pypi.org/project/clj/", "platform": "", "project_url": "https://pypi.org/project/clj/", "project_urls": { "Homepage": "https://github.com/bfontaine/clj" }, "release_url": "https://pypi.org/project/clj/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "Clojure-like utilities", "version": "0.1.3" }, "last_serial": 5488044, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "cafaea7a8cce7ee3c6d6f596f2df6903", "sha256": "5ff89228e3493882f1d097c855dd4e09e049e4f645c7bbb0e3ae2454b427b89c" }, "downloads": -1, "filename": "clj-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cafaea7a8cce7ee3c6d6f596f2df6903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8399, "upload_time": "2016-09-08T21:30:54", "url": "https://files.pythonhosted.org/packages/46/de/6d06743f2327f070602eb1f6dff525c92397de17fb418e206b13945e8468/clj-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6f6dfa6344d74697753c719a5910d847", "sha256": "f20a4ea71b85bee03bf59b3a6d1abc1a69948e1cb1912befc908998b432138d3" }, "downloads": -1, "filename": "clj-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6f6dfa6344d74697753c719a5910d847", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10671, "upload_time": "2019-01-12T11:20:28", "url": "https://files.pythonhosted.org/packages/a9/f1/3cfbe7eb43e2606bfb6d043eacfddb3704a05b6949d4dc70e54828972910/clj-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0dccb6550093483a5565a7cab22ec6ab", "sha256": "27a649d0651bdeb1e16da773e5c7c0ce86f0b7d5c8a01655b3691c4ac459d6a4" }, "downloads": -1, "filename": "clj-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0dccb6550093483a5565a7cab22ec6ab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10514, "upload_time": "2019-03-08T22:08:31", "url": "https://files.pythonhosted.org/packages/0e/1b/18485629a8210349899d5b032ebf9fbd36375095ac7a102343344bda2685/clj-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d5a09e51a2ab7fb23efa4b43f241b356", "sha256": "ea533579375e4593bcd8ddf8b08f74899ee953e76e53c91c41a40e7f689833d7" }, "downloads": -1, "filename": "clj-0.1.2.tar.gz", "has_sig": false, "md5_digest": "d5a09e51a2ab7fb23efa4b43f241b356", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13110, "upload_time": "2019-03-08T22:08:32", "url": "https://files.pythonhosted.org/packages/3f/0e/9277d53f4997b050b84eb593a5bd4274a24af70b96c5494b2cdde6809631/clj-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "bbeb084a6eaf16fa7a66745f323d6691", "sha256": "d8cddc2e96bfd0d7233a43974b1e01ce15d99152743fdcf9469e6c79e0b32164" }, "downloads": -1, "filename": "clj-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "bbeb084a6eaf16fa7a66745f323d6691", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10287, "upload_time": "2019-07-04T19:13:02", "url": "https://files.pythonhosted.org/packages/81/b4/653aacd09f99ba819a811dc822b735bc9525278f0c5f25dc69bc45e41401/clj-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2f8a1c0ecc702624f073baf014c5065b", "sha256": "c333a36878637daf1694dab44b8af53d0fbbd7f1984677124b4d0b2b65b4fb61" }, "downloads": -1, "filename": "clj-0.1.3.tar.gz", "has_sig": false, "md5_digest": "2f8a1c0ecc702624f073baf014c5065b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13143, "upload_time": "2019-07-04T19:13:05", "url": "https://files.pythonhosted.org/packages/f8/8e/4e6d94d687c67949f4ad1969081177afad994fba98020c1aa50b2abf981a/clj-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bbeb084a6eaf16fa7a66745f323d6691", "sha256": "d8cddc2e96bfd0d7233a43974b1e01ce15d99152743fdcf9469e6c79e0b32164" }, "downloads": -1, "filename": "clj-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "bbeb084a6eaf16fa7a66745f323d6691", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10287, "upload_time": "2019-07-04T19:13:02", "url": "https://files.pythonhosted.org/packages/81/b4/653aacd09f99ba819a811dc822b735bc9525278f0c5f25dc69bc45e41401/clj-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2f8a1c0ecc702624f073baf014c5065b", "sha256": "c333a36878637daf1694dab44b8af53d0fbbd7f1984677124b4d0b2b65b4fb61" }, "downloads": -1, "filename": "clj-0.1.3.tar.gz", "has_sig": false, "md5_digest": "2f8a1c0ecc702624f073baf014c5065b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13143, "upload_time": "2019-07-04T19:13:05", "url": "https://files.pythonhosted.org/packages/f8/8e/4e6d94d687c67949f4ad1969081177afad994fba98020c1aa50b2abf981a/clj-0.1.3.tar.gz" } ] }