I would expect the first program to return (5,6)
being an embedded dsl, core.logic sort of interleaves regular clojure with logic programming
what fresh does is bind a clojure variable to a logic variable
so you can imagine it as something like (let [r (fresh-logic-var)] ...)
so given a clojure program, where the local r
is bound to a logic variable, is there some expression like (... x ...)
that can result in r
being bound to something else?
a logic program doesn't change the value of bound clojure locals, it constrains the value of the logic variables bound by locals
you can use project to look up the value of a logic variable (an LVar) but that is not relational
what you should do is something like (compose-goals-with-or (for [constraint [fd/+ fd/*]] (constraint 2 3 q)))
but I don't recall what compose-goals-with-or would be
@hiredman thanks! this is exactly what I needed!
I'm hoping to make sense of some of these less obvious logic
functions and I'll write up some posts to hopefully make logic
easier to get running with!