User Tools

Site Tools


codeq:prolog:naloge:sister_2

This is an old revision of the document!


Table of Contents

Opis

Predikat sister(X, Y) velja natanko takrat, kadar je X sestra od Y. Primer klica:

?- sister(vanessa, X).
  X = patricia.

Predznanje

Puščice podaja predikat parent/2. Predikata male/1 in female/1 določata spol vsake osebe.

parent(tina,william).
parent(thomas,william).
parent(thomas,sally).
parent(thomas,jeffrey).
parent(sally,andrew).
parent(sally,melanie).
parent(andrew,joanne).
parent(jill,joanne).
parent(joanne,steve).
parent(william,vanessa).
parent(william,patricia).
parent(vanessa,susan).
parent(patrick,susan).
parent(patricia,john).
parent(john,michael).
parent(john,michelle).

parent(frank,george).
parent(estelle,george).
parent(morty,jerry).
parent(helen,jerry).
parent(jerry,anna).
parent(elaine,anna).
parent(elaine,kramer).
parent(george,kramer).

parent(margaret,nevia).
parent(margaret,alessandro).
parent(ana,aleksander).
parent(aleksandr,aleksander).
parent(nevia,luana).
parent(aleksander,luana).
parent(nevia,daniela).
parent(aleksander,daniela).

male(william).
male(thomas).
male(jeffrey).
male(andrew).
male(steve).
male(patrick).
male(john).
male(michael).
male(frank).
male(george).
male(morty).
male(jerry).
male(kramer).
male(aleksandr).
male(alessandro).
male(aleksander).

female(tina).
female(sally).
female(melanie).
female(joanne).
female(jill).
female(vanessa).
female(patricia).
female(susan).
female(michelle).
female(estelle).
female(helen).
female(elaine).
female(anna).
female(margaret).
female(ana).
female(nevia).
female(luana).
female(daniela).

Namigi

Testni primeri Heading 2
nex(sister(vanessa, andrew)) X in Y morata imeti (vsaj enega) skupnega starša.
nex(sister(vanessa, vanessa)) X ni sestra sama sebi.
codeq/prolog/naloge/sister_2.1436202575.txt.gz · Last modified: 2015/07/06 19:09 by timmy