Next: Constructing Data Structures
Up: Adding Computation Domains: CLP
Previous: Constructing Data Structures
-
- We may want to know who is spouse of who
-
- ?- married(couple(peter, S)).
S = anna
?- married(couple(marcia, S)).
no
-
- Argument order matters, of course
-
- We must specify what is a spouse
-
- spouse(couple(A, B), A).
spouse(couple(A, B), B).
-
- Then we can forget about the order
-
- ?- spouse(C, peter), married(C).
C = couple(peter,anna)
?- married(C), spouse(C, marcia).
C = couple(alvin,marcia)
?- spouse(C, luca), married(C).
no
Last modification: Thu Oct 7 12:04:03 MEST 1999 <webmaster@clip.dia.fi.upm.es>