I'm trying to use core.logic to figure out answer to the following equations:
x + y = W
x - y = V
W and V are both given, while x and y are the values I'm trying to compute.
I've tried approaches like (I substituted W with 60 and V with 10):
(logic/run* [q]
(logic/fresh [x y]
(logic/== q [x y])
(logic/project [x y]
; x + y = 60
; x - y = 10
(logic/== y (- 60 x))
(logic/== x (+ 10 y)))))
But it returns (["10<lvar:y_6>" NaN]) (I would expect 35 and 25).
How do I approach that? I don't want to use clojure.core.logic.fd because I'm using ClojureScript - is that possible at all? Would it be possible with fd?
Note that those equations are an example only. In my real-world scenario I want to solve something more like that:
x + H + y = W
x / y * 100 = V
For now I simplified those to get the most basic example running, but the solution to the above is also welcome :)