Fork me on GitHub
#core-logic
<
2017-10-27
>
xtreak2905:10:02

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

hiredman05:10:48

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

xtreak2906:10:03

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

xtreak2906:10:54

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.

xtreak2906:10:23

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

hiredman06:10:42

I don't know

pbaille06:10:43

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

pbaille06:10:07

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

pbaille06:10:57

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)

pbaille06:10:12

ok I've found

pbaille06:10:25

I have to use interval intead of row lvars

pbaille06:10:34

sorry for the noise

pbaille07:10:22

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