#logic #dsl #kanren

canrun

A logic programming library inspired by the *Kanren family of language DSLs

4 releases (breaking)

0.4.0 Jan 2, 2023
0.3.0 Aug 3, 2021
0.2.0 Jul 3, 2020
0.1.0 Jul 3, 2020

#152 in Math

Download history 3/week @ 2022-10-17 10/week @ 2022-10-24 14/week @ 2022-10-31 15/week @ 2022-11-07 11/week @ 2022-11-14 7/week @ 2022-11-21 4/week @ 2022-11-28 11/week @ 2022-12-05 11/week @ 2022-12-12 10/week @ 2022-12-19 6/week @ 2022-12-26 31/week @ 2023-01-02 7/week @ 2023-01-09 8/week @ 2023-01-16 20/week @ 2023-01-23 24/week @ 2023-01-30

59 downloads per month
Used in 2 crates

MIT/Apache

130KB
3K SLoC

CI Coverage Crate Documentation

Canrun is a logic programming library inspired by the *Kanren family of language DSLs.

Status: Exploratory and Highly Experimental

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.

Quick Start

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])

Dependencies

~1.5MB
~31K SLoC