{"id":19680752,"url":"https://github.com/codewars/lambda-calculus","last_synced_at":"2025-04-29T04:31:36.682Z","repository":{"id":41844556,"uuid":"447785644","full_name":"codewars/lambda-calculus","owner":"codewars","description":"Lambda Calculus compiler for Codewars","archived":false,"fork":false,"pushed_at":"2024-02-05T19:53:06.000Z","size":426,"stargazers_count":16,"open_issues_count":16,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-20T11:54:51.438Z","etag":null,"topics":["code-runner","code-runner-image"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/codewars.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}},"created_at":"2022-01-13T23:41:13.000Z","updated_at":"2024-08-29T12:01:10.000Z","dependencies_parsed_at":"2024-02-01T07:29:26.463Z","dependency_job_id":"bebc886c-252a-46d1-8687-a6d3c1459dce","html_url":"https://github.com/codewars/lambda-calculus","commit_stats":{"total_commits":170,"total_committers":5,"mean_commits":34.0,"dds":0.6235294117647059,"last_synced_commit":"9033667e62d688edd64b2fccd1115dd13dc33d4f"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewars%2Flambda-calculus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewars%2Flambda-calculus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewars%2Flambda-calculus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewars%2Flambda-calculus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewars","download_url":"https://codeload.github.com/codewars/lambda-calculus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251432847,"owners_count":21588665,"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":["code-runner","code-runner-image"],"created_at":"2024-11-11T18:05:56.159Z","updated_at":"2025-04-29T04:31:36.425Z","avatar_url":"https://github.com/codewars.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LC Compiler for Codewars\n\n![logo-black](./logo/logo-black.svg#gh-light-mode-only)\n![logo-white](./logo/logo-white.svg#gh-dark-mode-only)\n\nWritten by [Kacarott](https://github.com/Kacarott) and [JohanWiltink](https://github.com/JohanWiltink)\n\n### Install\n\n```bash\n$ npm i --save @codewars/lambda-calculus\n```\n\n### Usage\n\n\u003e NOTE: When writing tests on Codewars, you can use the predefined wrapper module \"./files.js\" to get\n\u003e the solution file instead of using `fs` like below.\n\n```javascript\nimport { readFileSync } from \"fs\";\n// Import module\nimport * as LC from \"@codewars/lambda-calculus\";\n\n// Set config options\nLC.config.purity = \"Let\";\nLC.config.numEncoding = \"Church\";\n\nconst code = readFileSync(\"solution.lc\", {encoding: \"utf8\"});\n// Compile\nconst solution = compile(code).TRUE;\n// or\nconst {TRUE,FALSE} = compile(code);\n\n// Use\nconsole.log(solution(true)(false)); // true\n// or\nconsole.log(TRUE(true)(false)) // true\n```\n\n### Documentation\n\n\n---\n\n`compile :: String -\u003e {String: (Term -\u003e Term)}`\n\n`compile` is the main entry point of the module. Compiles the specified text according the current `config` options, and returns an object binding all defined terms to their corresponding functions.\n\n---\n\n`config :: {String: String}`\n\n`config` is an object which provides the interface for controlling how compilation behaves. Currently there are three configurable properties: `purity`, `numEncoding` and `verbosity`.\n\n| Property | Option | Description |\n| -------- | ---- | ---- |\n| `purity` | `Let` | Allows definition of named terms which can be used in subsequent definitions. Does *not* support recursion. |\n|  | `LetRec` | The same as `Let`, but additionally supporting direct recursion. |\n|  | `PureLC` (default) | Pure lambda calculus only. Terms are still named so that they can be accessed by tests, but named terms may not be used elsewhere. |\n| `numEncoding` | `None` | No number encoding. Use of number literals will cause an error. |\n|  | `Church`\u003cbr\u003e`Scott`\u003cbr\u003e`BinaryScott` | Number literals will be automatically converted to corresponding LC terms, according to the encoding chosen. |\n| `verbosity` | `Calm`\u003cbr\u003e`Concise`\u003cbr\u003e`Loquacious`\u003cbr\u003e`Verbose` | Controls the amount of information that will be reported during compilation. |\n\n### Container Image\n\nThe container image used by the Code Runner is available on [GHCR](https://github.com/codewars/lambda-calculus/pkgs/container/lambda-calculus).\n\n```bash\ndocker pull ghcr.io/codewars/lambda-calculus:latest\n```\n\n#### Building\n\nThe image can be built from this repository:\n\n```bash\ndocker build -t ghcr.io/codewars/lambda-calculus:latest .\n```\n\n#### Usage\n\nSee [example/](./example/) to learn how to use the image to test locally.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewars%2Flambda-calculus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewars%2Flambda-calculus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewars%2Flambda-calculus/lists"}