Crates.io | canrun |
lib.rs | canrun |
version | 0.5.0 |
source | src |
created_at | 2020-07-03 01:25:14.434536 |
updated_at | 2023-05-31 03:07:31.623658 |
description | A logic programming library inspired by the *Kanren family of language DSLs. |
homepage | |
repository | https://github.com/tgecho/canrun_rs |
max_upload_size | |
id | 260827 |
size | 155,029 |
Canrun is a logic programming library inspired by the *Kanren family of language DSLs.
I'm still quite new to both Rust and logic programming, so there are likely to be rough edges. At best it may be a useful implementation of something that resembles the core concepts of a Kanren while being idiomatically Rusty. At worst it may just be a poor misinterpretation with fatal flaws.
use canrun::{LVar, Query};
use canrun::goals::{both, unify};
let x = LVar::new();
let y = LVar::new();
let goal = both(unify(x, y), unify(1, x));
let result: Vec<_> = goal.query(y).collect();
assert_eq!(result, vec![1])