Please help, trying to complete this by tonight to help me study for my exam, bu
ID: 3840631 • Letter: P
Question
Please help, trying to complete this by tonight to help me study for my exam, but I am stuck after trying many times.
1. What would be the output from append ([a,b, c], [one, two, three Result) 2. Given mother (mary sue). father (bob nancy mother (mary bill) father (bob jeff mother (sue nancy) father (bill ron) mother (sue jeff) parent (A, B father (A,B) parent (A, B) mother (A,B) mother (jane ron) father (john, Sue grandparent(C,D) parent(C,E), parent (E,D) sibling (x,Y) parent (P,x), parent (P,Y) XA-Y father (john, bill) a. Define a new relation cousin' that defines the relationship between any two people whose parents are siblings b. Write a query for this expanded program that will identify all people who are cousins. For example, the cousins of Ron would be (cousin ron, who).Explanation / Answer
Answer 1:
list construction is used when we wish to create a new list out of two existing lists.
to do this we use predicate append that takes three arguments. the first two are lists. the predicate 'append' iuses there two lists to
produce a third list which combines the origional two.
append([a,b,c],[one,two,three], Result)
Here [a,b,c] is first list, [one, two, three] is second list and 'Result' is thrird list which formed by predicate append.
Result =[a,b,c,one,two,three]