Thanks a lot David. As much as I'd like to contribute, I've only just 
started looking into logic programming.

Stathis

On Wednesday, 19 September 2012 17:42:09 UTC+1, David Nolen wrote:
>
> On Wed, Sep 19, 2012 at 11:11 AM, Stathis Sideris 
> <sid...@gmail.com<javascript:>> 
> wrote:
> > Hello,
> >
> > Is there a way to negate a goal in core.logic? I have written this goal
> > below, and I would like to use it to query all the pairs of people who 
> are
> > *not* relatives according to my facts (for dating purposes of course :-D)
> >
> > (defn relative [p1 p2]
> >   (conde
> >     [(parent p1 p2)]
> >     [(parent p2 p1)]
> >     [(sibling p1 p2)]
> >     [(cousin p1 p2)]
> >     [(nephew p1 p2)]
> >     [(uncle p1 p2)]))
> >
> >
> > Thanks,
> >
> > Stathis
>
> core.logic currently only supports Prolog's negation as failure. You can 
> write a goal that looks like this:
>
> (defn not [g]
>   (fn [a]
>     (if (nil? (g a))
>       a)))
>
> But you must be careful if you use this, all logic vars passed to the goal 
> g must be ground. So it's not relational.
>
> I have some leads based on recent Prolog research (CiaoProlog, and an 
> interesting dissertation on the abstract interpretation of Prolog) for 
> really handling negation in core.logic but I don't think I'll have time to 
> deal with it any time soon. Again, more than willing and excited to 
> collaborate with people who would like to see it done sooner.
>
> David
>

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

Reply via email to