nim-lang/needed-libraries

Embedded logic programming

zah opened this issue · 1 comments

zah commented

Nim can feature a logic programming engine embedded into the language as a DSL (it's possible to make it work both at compile-time and run-time). A popular minimalistic approach available in other languages is the miniKanren engine:

https://github.com/clojure/core.logic
https://github.com/logpy/logpy

A more sophisticated engines are also possible, but may require more work. See the following explanation for the differences between Kanren and a fully-featured Prolog engine:

https://stackoverflow.com/questions/28467011/what-are-the-main-technical-differences-between-prolog-and-minikanren-with-resp

Maybe this can be done in yield/generators implementation described here: http://yieldprolog.sourceforge.net/

I don't test it, maybe coroutines implements backtracking in a parallel can be tried as implementation base.