Fork me on GitHub
#core-logic
<
2016-03-27
>
exupero20:03:19

How should I do math with core.logic in ClojureScript without clojure.core.logic.fd?

exupero20:03:35

At the moment all I need is addition.

hiredman20:03:50

it sort of depends, if the variables are ground , you can use project

exupero21:03:39

@hiredman: Thanks for the pointer, but I don’t understand what that means. Can you elaborate or point me somewhere that talks about that?

hiredman21:03:36

project is a non-relational thing, because it depends on the order in which your logic program executes, and what it does is, give a logic variable, if by the time the project executes the logic program has already figured out the value of that logic variable, it gives you that value

hiredman21:03:42

so something like

(run [q] (fresh [a] (== a 1) (project [a] (== q (inc a))))
will work (I forget the syntax for project)

hiredman21:03:15

(run [q] (fresh [a]  (project [a] (== q (inc a))) (= a 1)))
will not

hiredman21:03:35

err that should be '(== a 1)' at the end

exupero21:03:05

Thanks. I’ll play with that.

exupero22:03:43

Perfect. Thanks!