I have been enjoying Clojure core.logic but I have run into a wall. I need to be able to have it use a database, either SQL or not, rather than an in memory data structure. As I have looked around I see mention of a to-stream function but no solid examples of its use.
Does anyone have a good example of using core.logic with a database?
As someone has already suggested in the comments look at the Datomic example in the core.logic repository. Based on the example there you could imagine writing something like this:
All core.logic goals just return closures which take a substitution map
a(you can of course call it whatever you like). Essentially you need to map over the results and unify them withoutina.Then you could imagine writing a core.logic program like the following: