Fork me on GitHub
#core-logic
<
2016-11-17
>
josh.freckleton19:11:20

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

hiredman19:11:19

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

hiredman19:11:32

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

hiredman19:11:55

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

hiredman19:11:26

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?

hiredman19:11:27

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

hiredman19:11:09

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

hiredman19:11:35

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

hiredman19:11:49

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

josh.freckleton20:11:46

@hiredman thanks! this is exactly what I needed!

josh.freckleton20:11:24

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!