next up previous
Next: Constructing Data Structures Up: Adding Computation Domains: CLP Previous: Constructing Data Structures

Constructing Data Structures

  $\mbox{$\bullet$}$
Being friends is symmetric
are_friends(A, B):- friends(A, B).
are_friends(A, B):- friends(B, A).
?- are_friends(anna, X).
X = marcia ;
X = luca

?- are_friends(X, anna).
X = marcia ;
X = luca
  $\mbox{$\bullet$}$
Some of our friends are married
married(couple(peter, anna)).
married(couple(mark, kathleen)).
married(couple(alvin, marcia)).
  $\mbox{$\bullet$}$
Note that married defines couples of persons
?- married(A).
A = couple(peter,anna) ;
A = couple(mark,kathleen) ;
A = couple(alvin,marcia)



Last modification: Thu Oct 7 12:04:03 MEST 1999 <webmaster@clip.dia.fi.upm.es>