/sanningens-silverflod

Constraint Handling Rules on top of DataScript Experiment

Primary LanguageClojureEclipse Public License 1.0EPL-1.0

Sanningens Silverflod

Allt genom lunden gröna, rinner det en flod -- Träd, Gräs och Stenar, 1970

Constraint Handling Rules on top of DataScript Experiment.

[[:drop [:gcd 0]]

 [:take [:gcd ?n]
  :drop [:gcd ?m]
  :when
  [(>= ?m ?n)]
  [(pos? ?n)]
  :then [:gcd (- ?m ?n)]]]

(->> #{[:gcd 9] [:gcd 6] [:gcd 3]}
     (run-once gcd-rules)
     deref
     constraints)
;=> #{[:gcd 3]}

This project is related to eyvind, which is aimed to explore (potential) distributed approaches, while this project leverages DataScript and focuses on exploring usage, in-memory and concurrent execution.

The current implementation is pretty naive and single threaded. It's also broken.

References

Intros to Constraint Handling Rules (CHR)

CHR Implementation Theory

Join Calculus

CHR Implementations

Embedded Prolog

License

Copyright © 2015 Håkan Råberg

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.