I am interested in solving a simple equation for all of its solutions when 
some constraints are applied.  This sounds like a problem for core.logic.fd.

Let's use a toy example:

8 = 3*x + 2*y,  where x and y must be non-negative integers.

Here are the possible solutions:  [x,y]= {[2,1],[0,4]}.


I tried something like this:

(run* [q]
      (fresh [x y]
             (== q [x y])
                   (project [x y]
      (fd/+ (* x 2) (y 3) 8))))

But I get a exception:
"java.lang.ClassCastException: clojure.core.logic.LVar cannot be cast to 
java.lang.Number"

So I have two questions:
1. How should I rewrite the above command to get the solutions?
2. Are there any good blog posts/online presentations/etc. on core.logic.fd?



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to