µKanren-rs
This is a Rust implementation of µKanren, a featherweight relational programming language. See the original Scheme implementation here for reference.
Features
- Structural unification of Scheme-like cons cells.
- Streams implemented with the
Iteratortrait. - State representation using a persistent vector with triangular substitutions.
- Conjunction, disjunction, and
freshbased on traits (macro-free API). - Lazy goal evaluation using inverse-η delay.
- Integer,
bool,char,&str, and unit type atoms. - Explicit
ToValuetrait that converts vectors and arrays into cons-lists. - Convenience macro
state!to inspect and specify state.
Usage
Here's a simple example, which defines and uses the appendo predicate.
use *;
let goal = fresh;
assert_eq!;
More examples can be found in the tests/ folder and the API documentation.