Question: . Rewrite your family database (assignment 4), but this time use PROLOG's lists (HIT) to represent the basic facts of your family. Save it as
. Rewrite your family database (assignment 4), but this time use PROLOG's lists (HIT) to represent the basic facts of your family. Save it as an ordinary text file named familylists.pro Your program should implement the following facts for your immediate family, grandparents, and great- grandparents family([mom,dad],[daughterl, daughter2], [son1,son2]]) In other words, each "nuclear" family is comprised of two lists: family(ParentList, ChildrenList). The ParentList is formatted with the name of the mother, followed by the name of the father. The ChildrenList consists of two sublists, the first giving the names of the daughters, in chronological order, and the second giving the names of the sons, in chronological order All other predicates should be defined in terms of the above facts. For example, consider the following definitions father-of(DC) :-family(LDIJDsSs]), (member(C.Ds); member(C,Ss)) parent of(P,C): father_of(P,C) parent of(PC):- mother of(P,C) male(M):- family(L_,M],_) male(M):- family_,[_,Ss]), member(M,Ss) member(M,[M ) member(M.[HIT] :-member(M,T). % base case % recursive case
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
