core-logic

2016-11-17T19:39:20.000371Z

I would expect the first program to return (5,6)

2016-11-17T19:53:19.000372Z

being an embedded dsl, core.logic sort of interleaves regular clojure with logic programming

2016-11-17T19:53:32.000373Z

what fresh does is bind a clojure variable to a logic variable

2016-11-17T19:53:55.000374Z

so you can imagine it as something like (let [r (fresh-logic-var)] ...)

2016-11-17T19:55:26.000375Z

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?

2016-11-17T19:56:27.000376Z

a logic program doesn't change the value of bound clojure locals, it constrains the value of the logic variables bound by locals

2016-11-17T19:58:09.000377Z

you can use project to look up the value of a logic variable (an LVar) but that is not relational

2016-11-17T19:59:35.000378Z

what you should do is something like (compose-goals-with-or (for [constraint [fd/+ fd/*]] (constraint 2 3 q)))

2016-11-17T19:59:49.000379Z

but I don't recall what compose-goals-with-or would be

2016-11-17T20:01:46.000382Z

@hiredman thanks! this is exactly what I needed!

2016-11-17T20:05:24.000383Z

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!