core-logic

xtreak29 2017-10-27T05:54:02.000219Z

@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.

xtreak29 2017-10-27T05:54:36.000159Z

Here I want states to be supplied to fresh : https://gist.github.com/tirkarthi/df7b99ad5d9d04745b67040093598984

2017-10-27T05:56:08.000203Z

https://gist.github.com/hiredman/05befd5b39eef89b86ca#file-bench-clj-L33-L35 is an old example of generating lvars dynamiclly

2017-10-27T05:56:48.000097Z

fresh you can think of as a macro, (fresh [x] ...) -> (let [x (lvar)] ...)

xtreak29 2017-10-27T06:06:03.000083Z

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))

2017-10-27T06:06:47.000020Z

yes

xtreak29 2017-10-27T06:11:54.000005Z

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.

xtreak29 2017-10-27T06:12:23.000067Z

Also I realize the whole unification is dependent on each other and cannot be parallelized

2017-10-27T06:13:42.000064Z

I don't know

pbaille 2017-10-27T06:28:43.000008Z

Hi! I'm a beginner with logic programing. does anyone mind to tell me how can I make this code work:

pbaille 2017-10-27T06:29:07.000186Z

(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)))

pbaille 2017-10-27T06:29:57.000081Z

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)

pbaille 2017-10-27T06:32:12.000270Z

ok I've found

pbaille 2017-10-27T06:32:25.000066Z

I have to use interval intead of row lvars

pbaille 2017-10-27T06:32:34.000168Z

sorry for the noise

pbaille 2017-10-27T07:51:22.000103Z

what are some logic programing utils libraries built on top of core.logic?