OH, I just realized how! (? (loves Mark @X) (woman @X))
It seems obvious in hindsight XD On Sun, Jul 1, 2018 at 10:37 PM Bruno Franco <[email protected]> wrote: > Yeah! that is exactly right! > > All this time I had tried to use the "?" function like this: > (? ((loves Mark @X) (woman @X))) > But it returned NIL. > > So, when you search for a variable that can satisfy more than one > predicate, > you make a list of predicates (call it PList) and pass it as argument to > (prove (goal PList)). > > Is there a way to do that using only the "?" function, or must it always > be wrapped by the (prove (goal )) combo? > > > On Sun, Jul 1, 2018 at 6:05 PM Johann-Tobias Schäg <[email protected]> > wrote: > >> I've got it working the following way. It is very inelegant but it shows >> the idea. >> >> (be woman (Ann)) >> #-> woman >> (prove (goal (woman @X))) # wrong >> #!? (woman @X) >> #woman -- Undefined >> (prove (goal '((woman @X)))) #quoted list can contain multiple statements >> #-> ((@X . Ann)) >> (be loves (Mark Ann)) >> #-> loves >> (be loves (Mark Max)) >> #-> loves >> (prove (goal '((loves Mark @X) (woman @X)))) #as is seen here >> #-> ((@X . Ann)) >> >> does that help? >> >> *Von:* [email protected] >> *Gesendet:* 1. Juli 2018 11:49 nachm. >> *An:* [email protected] >> *Antworten:* [email protected] >> *Betreff:* A query in Pilog >> >> I'm going through the "Learn Prolog Now!" ebook and I ran into this query: >> >> ?- loves(marsellus,X), woman(X). >> >> And I can't figure out how to do it in pilog. >> Is there a function that can test multiple queries at once, like or/2 >> does? >> >> thanks >> >
