{"id":27957667,"url":"https://github.com/ajcr/jinx","last_synced_at":"2026-05-17T10:37:03.263Z","repository":{"id":284247415,"uuid":"951927455","full_name":"ajcr/jinx","owner":"ajcr","description":"Experimental interpreter for the J programming language","archived":false,"fork":false,"pushed_at":"2025-12-22T21:26:45.000Z","size":426,"stargazers_count":5,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-22T09:47:29.087Z","etag":null,"topics":["array","interpreter","j","numpy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajcr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-20T13:12:42.000Z","updated_at":"2025-12-28T23:33:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"36a5ba9f-96df-4925-a912-bd77601f9831","html_url":"https://github.com/ajcr/jinx","commit_stats":null,"previous_names":["ajcr/jinx"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ajcr/jinx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajcr%2Fjinx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajcr%2Fjinx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajcr%2Fjinx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajcr%2Fjinx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajcr","download_url":"https://codeload.github.com/ajcr/jinx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajcr%2Fjinx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33135105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","interpreter","j","numpy"],"created_at":"2025-05-07T18:14:02.812Z","updated_at":"2026-05-17T10:37:03.251Z","avatar_url":"https://github.com/ajcr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jinx\n\n![ci](https://github.com/ajcr/jinx/actions/workflows/ci.yaml/badge.svg?branch=main)\n\nAn experimental interpreter for the [J programming language](https://www.jsoftware.com/#/), built on top of [NumPy](https://numpy.org/).\n\nImplements many of J's primitives and tacit programming capabilities, and can be extended to execute via other backends too.\n\nCan be installed via PyPI:\n```sh\npip install jjinx  # note the double 'j'\n```\n\n## The J Shell\n\nStart the interactive shell:\n```sh\njinx\n```\nThe shell prompt is four spaces, so commands appear indented. Internally, all multidimensional arrays are NumPy arrays. Verbs, conjunctions and adverbs are a mixture of Python and NumPy methods.\n\nHere are some examples what Jinx can do so far:\n\n- Solve the \"trapping rainwater\" problem (solution taken from [here](https://mmapped.blog/posts/04-square-joy-trapped-rain-water)):\n```j\n    +/@((\u003e./\\ \u003c. \u003e./\\.)-]) 0 1 0 2 1 0 1 3 2 1 2 1\n6\n```\n- Compute the correlation between two arrays of numbers (taken from [here](https://stackoverflow.com/a/44845495/3923281)). This is a interesting combination of different trains of verbs, adverbs and conjunctions:\n```j\n    2 1 1 7 9 (+/@:* % *\u0026(+/)\u0026.:*:)\u0026(- +/%#) 6 3 1 5 7\n0.721332\n```\n- Create identity matrices in inventive ways (see [this essay](https://code.jsoftware.com/wiki/Essays/Identity_Matrix)):\n```j\n    |.@~:\\ @ ($\u00260) 3\n1 0 0\n0 1 0\n0 0 1\n\n    (i.@,~ = \u003e: * i.) 3\n1 0 0\n0 1 0\n0 0 1\n\n    ((={:)\\ @ i.) 3\n1 0 0\n0 1 0\n0 0 1\n```\n- Solve the Josephus problem (see [this essay](https://code.jsoftware.com/wiki/Essays/Josephus_Problem)). Calculate the survivor's number for a circle of people of size N. Note the use of the verb obverse and the rank conjunction:\n```j\n    (1\u0026|.\u0026.#:)\"0 \u003e: i. 5 10    NB. N ranges from 1 to 50 here (arranged as a table)\n 1  1  3  1  3  5  7  1  3  5\n 7  9 11 13 15  1  3  5  7  9\n11 13 15 17 19 21 23 25 27 29\n31  1  3  5  7  9 11 13 15 17\n19 21 23 25 27 29 31 33 35 37\n```\n- Build nested boxes containing heterogeneous data types and print the contents:\n```j\n    (\u003c\u003c'abc'),(\u003c(\u003c'de',.'fg'),(\u003c\u003ci. 5 2)),(\u003c(\u003c\"0 ] % i. 2 2 3))\n┌─────┬──────────┬────────────────────────────┐\n│┌───┐│┌──┬─────┐│┌────────┬────────┬────────┐│\n││abc│││df│┌───┐│││_       │1       │0.5     ││\n│└───┘││eg││0 1│││├────────┼────────┼────────┤│\n│     ││  ││2 3││││0.333333│0.25    │0.2     ││\n│     ││  ││4 5│││└────────┴────────┴────────┘│\n│     ││  ││6 7│││                            │\n│     ││  ││8 9│││┌────────┬────────┬────────┐│\n│     ││  │└───┘│││0.166667│0.142857│0.125   ││\n│     │└──┴─────┘│├────────┼────────┼────────┤│\n│     │          ││0.111111│0.1     │0.090909││\n│     │          │└────────┴────────┴────────┘│\n└─────┴──────────┴────────────────────────────┘\n```\n\n## Toggle Between Python and J interpreters\n\nIn Jinx all J arrays are Python objects internally.\n\nThe `py:` verb (with no arguments) will switch to a Python interpreter. Array variables created in J can now be operated on in Python:\n```\n    a =: i. 3 3           NB. name `a` assigned to J noun\n0 1 2\n3 4 5\n6 7 8\n    py:\nSwitching to Python interpreter mode. Use 'ctrl-D' to return to Jinx.\n\u003e\u003e\u003e a                     # variable `a` assigned to underlying NumPy array\narray([[0, 1, 2],\n       [3, 4, 5],\n       [6, 7, 8]])\n```\nArray variables that are assigned to arrays in Python will be accessible as J arrays when returning to Jinx:\n```\n\u003e\u003e\u003e b = a.sum(axis=0)     # variable `b` assigned to new NumPy array\n\u003e\u003e\u003e b\narray([ 9, 12, 15])\n\u003e\u003e\u003e ^D\nReturning to Jinx shell.\n    b                     NB. name `b` assigned to equivalent J noun\n9 12 15\n```\n\n## Easy To Customise\n\nJinx is written in reasonably-readable Python and adding new primitives is simple.\n\nUpdate the `primitives.py` file with your new part of speech (e.g. a new verb such as `+::`). Write your implementation of this new part of speech in the relevant executor module (e.g. `verbs.py`) and then update the name-to-method mapping at the foot of that module. That's all that's needed.\n\n## Alternative Executors\n\nExecution of sentences is backed by NumPy by default.\n\nHowever, Jinx is designed so that it is possible to execute sentences using alternative frameworks too. Python has many Machine Learning and Scientific Programming libraries that could be used to execute J code, albeit with different sets of tradeoffs.\n\nTo prove this concept, Jinx currently has _highly experimental and incomplete_ support for [JAX](https://docs.jax.dev/en/latest/index.html):\n```sh\njinx --executor jax\n```\nPrimitive verbs are JIT compiled and nouns are backed by JAX arrays:\n```j\n    mean =: +/ % #\n    mean 33 55 77 100 101\n73.2\n```\n\n## Warning\n\nThis project is experimental and began as a project to learn J in more depth. There will be bugs, missing features and performance quirks.\n\nYou will notice that many key parts of J are not currently implemented (but might be in future). These include:\n- Differences in how names are interpreted and resolved at execution time.\n- Locales.\n- Definitions and direct definitions (using `{{ ... }}`).\n- Array types other than floats, integers and and strings.\n- Executing J scripts.\n- Control words.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajcr%2Fjinx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajcr%2Fjinx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajcr%2Fjinx/lists"}