Testy pluginu prolog.


<prolog cache=„true” goal=„zwierze(X),write(X),nl,fail”> zwierze(pies). zwierze(kot). </prolog>


Family Definitions

Father and Mother

A parent and a female is somebody's mother. A parent and a male is somebody's father.

<prolog cache=„true”> mother(X,Y) :-

parent(X,Y),
female(X).

father(X,Y) :-

parent(X,Y),
male(X).

</prolog>

Families

Info about all families gathered in this namespace.

<prolog scope=„.:*_family”> </prolog>

Smith Family

There is Kate and Liz obviously girls, and a couple of boys: Tom and Bob. Kate is Bob's mom, while Tom is his dad. Tom is also Liz's dad.

<prolog cache=„true”> female(person(kate,smith)). female(person(liz,smith)).

male(person(tom,smith)). male(person(bob,smith)).

parent(person(kate,smith),person(bob,smith)). parent(person(tom,smith),person(bob,smith)). parent(person(tom,smith),person(liz,smith)). </prolog>

-RESULT-

Males

<prolog goal=„male(X),write(X),nl,fail” scope=„.*”> </prolog>

Mothers

<prolog goal=„mother(X,Y),write(X),nl,fail” scope=„.*:testyprolog2”> </prolog>

Fathers

<prolog goal=„father(X,Y),write(X),nl,fail” scope=„pl:miw:miw08_dokuviz:testyprolog2”> </prolog>

Mothers2

<prolog goal=„mother(X,_),write(X),nl,fail” scope=„.*family” > </prolog>

and again:

<prolog goal=„mother(X,_),write(X),nl,fail” scope=„.*family.*”> </prolog>

pl/miw/miw08_dokuviz/testyprolog2.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0