{"id":15873900,"url":"https://github.com/wavejumper/clj-polyglot","last_synced_at":"2025-06-27T13:39:54.884Z","repository":{"id":62435113,"uuid":"266492785","full_name":"wavejumper/clj-polyglot","owner":"wavejumper","description":"Clojure library for graal's polyglot functionality","archived":false,"fork":false,"pushed_at":"2020-09-21T23:47:01.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T05:03:31.691Z","etag":null,"topics":["clojure","clojurescript","graalvm","interop","javascript","polyglot"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wavejumper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-24T07:38:48.000Z","updated_at":"2023-09-08T18:07:53.000Z","dependencies_parsed_at":"2022-11-01T21:15:54.300Z","dependency_job_id":null,"html_url":"https://github.com/wavejumper/clj-polyglot","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavejumper%2Fclj-polyglot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavejumper%2Fclj-polyglot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavejumper%2Fclj-polyglot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavejumper%2Fclj-polyglot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavejumper","download_url":"https://codeload.github.com/wavejumper/clj-polyglot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243802944,"owners_count":20350316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["clojure","clojurescript","graalvm","interop","javascript","polyglot"],"created_at":"2024-10-06T01:08:12.349Z","updated_at":"2025-03-16T04:30:47.040Z","avatar_url":"https://github.com/wavejumper.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Clojars Project](https://img.shields.io/clojars/v/wavejumper/clj-polyglot.svg)](https://clojars.org/wavejumper/clj-polyglot)\n[![CircleCI](https://circleci.com/gh/wavejumper/clj-polyglot.svg?style=svg)](https://circleci.com/gh/wavejumper/clj-polyglot)\n\n# clj-polygot\n\nClojure library for graalvm's polyglot functionality. Requires JDK11+ or a graalvm runtime.\n\n* `clj-polyglot.core` - eval fn + seralization/deserialization fns\n* `clj-polyglot.js` - JavaScript context\n\nThis library was used to build [tonal-clj](https://github.com/wavejumper/tonal-clj)\n\n**TODO**: extend this library to support other graalvm languages \n\n# Examples\n\n## tonal\n\nConsider a JavaScript API like [tonal](https://github.com/tonaljs/tonal#example): \n\n```javascript\nimport { Note, Interval, Scale } from \"@tonaljs/tonal\";\nNote.freq(\"a4\").freq; // =\u003e 440\n```\n\nWe can interface with this library like so:\n\n```clojure\n(require '[clj-polyglot.core :as poly])\n(require '[clj-polyglot.js :as poly.js])\n\n(def tonal-src \n (slurp \"https://cdn.jsdelivr.net/npm/@tonaljs/tonal/browser/tonal.min.js\"))\n\n(def ctx\n  (poly.js/js-ctx tonal-src))\n\n(def tonal\n  (poly.js/from ctx \"Tonal\"))\n\n(def api\n  (poly.js/import tonal :Note [:midi :freq]))\n\n(defn freq [note]\n  (poly/eval api :freq note))\n\n(freq \"A4\") ;; =\u003e 440\n``` \n\n## asciichart \n\nConsider a JavaScript API like [asciichart](https://github.com/kroitor/asciichart)\n\n```javascript\nvar asciichart = require ('asciichart');\nasciichart.plot([1,2,3]);\n```\n\n```clojure\n(def asciichart-src \n  (slurp \"https://cdn.jsdelivr.net/npm/asciichart@1.5.21/asciichart.js\"))\n\n(def ctx \n  (poly.js/js-ctx asciichart-src))\n\n(def asciichart\n  (poly.js/from ctx \"asciichart\"))\n\n(def api \n  (poly.js/import asciichart [:plot]))\n\n(def plot [values]\n  (poly/eval api :plot values))\n\n(plot [1 2 3])\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavejumper%2Fclj-polyglot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavejumper%2Fclj-polyglot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavejumper%2Fclj-polyglot/lists"}