Crate canrun[−][src]
Expand description
Canrun is a logic programming library inspired by the *Kanren family of language DSLs.
- Intro blog post: https://esimmler.com/announcing-canrun/
- How it works (part 1): https://esimmler.com/building-canrun-part-1/
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::{domain, var, Goal, both, unify}; domain! { pub I32 { i32 } } let x = var(); let y = var(); let goal: Goal<I32> = both(unify(x, y), unify(1, x)); let result: Vec<_> = goal.query(y).collect(); assert_eq!(result, vec![1])
What’s next? Go read a breakdown of this example in the deeper Quick Start explanation.
Re-exports
Modules
Collections and related goal functions.
Tutorials and other more in-depth documentation (mostly WIP).
Constrain the set of types that you can reason about in a particular context.
Basic domains for simple use cases.
Make declarative assertions about the relationships between values.
Track value bindings and constraints during the evaluation process.
Assorted helpers, especially for testing.
Contain individual resolved values or variables that can be bound through unification.
Macros
Create a goal that only succeeds if all sub-goals succeed.
Create a goal that yields a state for every successful sub-goal.
Create an LMap
with automatic key/value IntoVal
wrapping.
Create a tuple of logical values with automatic IntoVal
wrapping.
Create an LVec<T>
with automatic value IntoVal
wrapping.