@hiredman Thanks. But how can I represent the lvars in fresh. I might have 3 lvars or 10 lvars to fresh and I might have and those lvars of the name mapped to different constraints. I am trying to solve the coloring problem using core.logic and I want to make the state
var to be supplied as lvar to fresh
. Also I have the neighbor
clauses which I want to generate from a map. Does using and* correctly match the lvars from fresh to the one generated. I might be doing something wrong here since I am new to core.logic and clojure macros.
Here I want states to be supplied to fresh : https://gist.github.com/tirkarthi/df7b99ad5d9d04745b67040093598984
https://gist.github.com/hiredman/05befd5b39eef89b86ca#file-bench-clj-L33-L35 is an old example of generating lvars dynamiclly
fresh you can think of as a macro, (fresh [x] ...) -> (let [x (lvar)] ...)
Thanks. I saw the code for solve-bench
. So I can just use
(run 1 [q]
(and (foo (:x bench) (:y bench))
(foo (:y bench) (:x bench)))
(== q bench))
yes
Is there a limit on the stack or anything in JVM for the number of lvars. I am trying to unify some 600 lvars against around 4000 goals. The prolog version segfaulted on my machine. Just wanted to know if something that big is done or possible technically.
Also I realize the whole unification is dependent on each other and cannot be parallelized
I don't know
Hi! I'm a beginner with logic programing. does anyone mind to tell me how can I make this code work:
(run 1 [q]
(fresh [dom a b]
(== dom (apply fd/domain (range 11)))
(l/everyg #(fd/in % dom) [a b])
(== q [a b])
(fd/* a b 100)))
I've got this error: IllegalArgumentException No implementation of method: :-lb of protocol: #'clojure.core.logic.fd/IInterval found for class: clojure.core.logic.LVar clojure.core/-cache-protocol-fn (core_deftype.clj:568)
ok I've found
I have to use interval intead of row lvars
sorry for the noise
what are some logic programing utils libraries built on top of core.logic?