(, ) , , . . , , ; . , , , .
Prolog. . . , , . , , . 4.1. Prolog. , . FoxFaxily = family { person) ton, fox, _,_>,_,_>
, , . 4,1. , . ( ) . : , , :
selector_relation(Object, Component_selected)
.
children! family! _, _, ChiltiList), ChildList).
, :
firstchildt Family, First):-
children) Family, [First |. _] >. secondchildt Family, Second):-
children) Family, [ _, Second _]),
, - , : nthchildl , Family, Child):-
nth_membe^XChildList, Child). % n-
. , , . 4.1.
firstnamef person (Hame, _,_,_), ). surname ( _, Surname,, I, Surname].
borni person(_,_,Date, J, Date).
, , . -
|
|
102 I. Prolog
. , . , , . , , , . , , Fersonl Person2, . :
firstnamef Fersonl, torn), surname (Personl, fox), % Fersonl - firstname< Person2, j im), surname (Person2, fox), % Person2 - husband{ Family, Personl), secandchild; Family, Person2)
Personl, Person2 Family :
Personl - person; torn, fox, _, _) Person2 = person; jirn, fox, _, _! Family = familyf person [torn, fox, _,_), _, [ _, person (jim, fox) | _ ]>
. , . , .