core-logic

2016-03-27T20:09:19.000020Z

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

2016-03-27T20:09:35.000021Z

At the moment all I need is addition.

2016-03-27T20:43:50.000022Z

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

2016-03-27T21:03:39.000023Z

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

2016-03-27T21:16:36.000024Z

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

2016-03-27T21:18:42.000025Z

so something like

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

2016-03-27T21:19:15.000026Z

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

2016-03-27T21:21:35.000027Z

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

2016-03-27T21:48:05.000028Z

Thanks. I’ll play with that.

2016-03-27T22:03:43.000029Z

Perfect. Thanks!