Is there a way in core.logic to get something like the "best possible 
substitution" for a goal that doesn't complete?

I wrote a macro:

   1. (defn- condf-fn
   2.   "Allows each line to incrementally succeed."
   3.   [& [g & gs :as goals]]
   4.   (if (empty? goals)
   5.     ()
   6.     `((conde
   7.        ( succeed )
   8.        ( ~@g
   9.          ~@(apply condf-fn gs) )))))
   10.  
   11. (defmacro condf
   12.   [& goals]
   13.   (first (apply condf-fn goals)))
   

And you can run something like this:

   1. (run* [q]
   2.          (fresh [x y z]
   3.           (condf
   4.            ( (== x :X) )
   5.            ( (== y :Y) )
   6.            ( (== z :Z) ))
   7.           (== q [x y z])))
   8. ([_.0 _.1 _.2] [:X _.0 _.1] [:X :Y _.0] [:X :Y :Z])
   

But the problem is that order matters.  Is there a way around that?

-- 
-- 
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/groups/opt_out.


Reply via email to