{"id":13749274,"url":"https://github.com/ekzhang/ukanren-rs","last_synced_at":"2025-05-08T21:16:40.177Z","repository":{"id":57671019,"uuid":"404944605","full_name":"ekzhang/ukanren-rs","owner":"ekzhang","description":"Rust implementation of µKanren, a featherweight relational programming language.","archived":false,"fork":false,"pushed_at":"2023-01-01T20:59:49.000Z","size":39,"stargazers_count":113,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-08T21:16:33.771Z","etag":null,"topics":["functional-programming","language","logic-programming","microkanren","minikanren","prolog","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/ukanren","language":"Rust","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/ekzhang.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}},"created_at":"2021-09-10T03:28:18.000Z","updated_at":"2025-03-26T02:23:03.000Z","dependencies_parsed_at":"2023-02-01T01:01:20.410Z","dependency_job_id":null,"html_url":"https://github.com/ekzhang/ukanren-rs","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekzhang%2Fukanren-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekzhang%2Fukanren-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekzhang%2Fukanren-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekzhang%2Fukanren-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekzhang","download_url":"https://codeload.github.com/ekzhang/ukanren-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253149621,"owners_count":21861740,"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":["functional-programming","language","logic-programming","microkanren","minikanren","prolog","rust"],"created_at":"2024-08-03T07:00:58.271Z","updated_at":"2025-05-08T21:16:40.156Z","avatar_url":"https://github.com/ekzhang.png","language":"Rust","funding_links":[],"categories":["Kanren","Rust"],"sub_categories":["Libraries"],"readme":"# µKanren-rs\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-ekzhang/ukanren--rs-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/ekzhang/ukanren-rs)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/ukanren.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/ukanren)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-ukanren-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logoColor=white\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K\" height=\"20\"\u003e](https://docs.rs/ukanren)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/actions/workflow/status/ekzhang/ukanren-rs/ci.yml?style=for-the-badge\" height=\"20\"\u003e](https://github.com/ekzhang/ukanren-rs/actions?query=branch%3Amain)\n\nThis is a Rust implementation of µKanren, a featherweight relational programming\nlanguage. See the original Scheme implementation\n[here](http://webyrd.net/scheme-2013/papers/HemannMuKanren2013.pdf) for\nreference.\n\n## Features\n\n- Structural unification of Scheme-like cons cells.\n- Streams implemented with the `Iterator` trait.\n- State representation using a persistent vector with triangular substitutions.\n- Conjunction, disjunction, and `fresh` based on traits (macro-free API).\n- Lazy goal evaluation using inverse-η delay.\n- Integer, `bool`, `char`, `\u0026str`, and unit type atoms.\n- Explicit `ToValue` trait that converts vectors and arrays into cons-lists.\n- Convenience macro `state!` to inspect and specify state.\n\n## Usage\n\nHere's a simple example, which defines and uses the `appendo` predicate.\n\n```rust\nuse ukanren::*;\n\nfn appendo(first: Value, second: Value, out: Value) -\u003e BoxedGoal\u003cimpl Iterator\u003cItem = State\u003e\u003e {\n    eq(\u0026first, \u0026())\n        .and(eq(\u0026second, \u0026out))\n        .or(fresh(move |a: Value, d: Value, res: Value| {\n            eq(\u0026(a.clone(), d.clone()), \u0026first)\n                .and(eq(\u0026(a, res.clone()), \u0026out))\n                .and(appendo(d, second.clone(), res))\n        }))\n        .boxed()\n}\n\nlet iter = run(|x, y| appendo(x, y, [1, 2, 3, 4, 5].to_value()));\nassert_eq!(\n    iter.collect::\u003cVec\u003c_\u003e\u003e(),\n    vec![\n        state![(), [1, 2, 3, 4, 5]],\n        state![[1], [2, 3, 4, 5]],\n        state![[1, 2], [3, 4, 5]],\n        state![[1, 2, 3], [4, 5]],\n        state![[1, 2, 3, 4], [5]],\n        state![[1, 2, 3, 4, 5], ()],\n    ],\n);\n```\n\nMore examples can be found in the `tests/` folder and the API documentation.\n\n\u003cbr\u003e\n\n\u003csup\u003e\nMade by Eric Zhang for\n\u003ca href=\"https://pl-design-seminar.seas.harvard.edu/\"\u003eCS 252r\u003c/a\u003e. All code is\nlicensed under the \u003ca href=\"LICENSE\"\u003eMIT License\u003c/a\u003e.\n\u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekzhang%2Fukanren-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekzhang%2Fukanren-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekzhang%2Fukanren-rs/lists"}