{"id":19739446,"url":"https://github.com/rkrupinski/clojure-lite","last_synced_at":"2025-04-30T05:32:02.128Z","repository":{"id":57200536,"uuid":"77169026","full_name":"rkrupinski/clojure-lite","owner":"rkrupinski","description":"Compiles an extremely small subset of clojure to JavaScript","archived":false,"fork":false,"pushed_at":"2016-12-22T19:06:55.000Z","size":4,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-13T18:57:57.027Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/rkrupinski.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":"2016-12-22T19:02:49.000Z","updated_at":"2020-03-06T12:05:02.000Z","dependencies_parsed_at":"2022-09-16T15:10:33.340Z","dependency_job_id":null,"html_url":"https://github.com/rkrupinski/clojure-lite","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/rkrupinski%2Fclojure-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrupinski%2Fclojure-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrupinski%2Fclojure-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkrupinski%2Fclojure-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rkrupinski","download_url":"https://codeload.github.com/rkrupinski/clojure-lite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224197919,"owners_count":17272021,"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":[],"created_at":"2024-11-12T01:17:22.202Z","updated_at":"2024-11-12T01:17:22.785Z","avatar_url":"https://github.com/rkrupinski.png","language":"JavaScript","readme":"# clojure-lite\n\n*Disclaimer: this is a super-immature toy project :bowtie:*\n\n`clojure-lite` compiles an extremely small subset of [clojure](https://clojure.org/) to JavaScript. That's pretty much all it does. Have fun!\n\nIt currently lets you:\n- define and refer variables\n- define and call functions\n\nOther quirks:\n- the standard library is limited to `+`, `-`, `*`, and `/`\n- there's only one type: `number`\n\n## Example\n```clojure\n(def PI 3.141592653589793)\n(defn area [radius] (* PI radius radius))\n(area 5)\n```\nis compiled to:\n```javascript\nconst __lib = {};\n__lib['*'] = function (...args) {\n  return args.reduce((acc, curr) =\u003e acc * curr, 1);\n};\nlet PI = 3.141592653589793;\nfunction area(radius) {\n  return __lib['*'](PI, radius, radius);\n}\narea(5);\n```\n\n## Usage\nProgrammatic:\n\n```sh\n$ npm install clojure-lite --save\n```\n```javascript\nconst cl = require('clojure-lite');\n\nconst compile = _.compose(\n  cl.codegen,\n  cl.parser,\n  cl.lexer\n);\n\nconst code = compile('(def answer 42)');\n```\n\nCLI:\n\n```sh\n$ npm install -g clojure-lite\n```\n```sh\n$ echo '(def answer 42)' | cl \u003e code.js\n```\n\n## Credits\n- `lexer` heavily inspired by [[click]](https://www.codeproject.com/articles/345888/how-to-write-a-simple-interpreter-in-javascript).\n- `parser` \u0026 `codegen` heavily inspired by [[click]](https://github.com/thejameskyle/the-super-tiny-compiler).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkrupinski%2Fclojure-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frkrupinski%2Fclojure-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkrupinski%2Fclojure-lite/lists"}