Question: Consider the Prolog database and procedures given below distance (X,Y,D) - (X,Y,D); d(Y,X,D). d(pta, bfa, 455) dbfn, ct,990) d(bfn,pe,680) a(zhb, kby, 470). (ct, kby, 970)

Consider the Prolog database and procedures given below distance (X,Y,D) - (X,Y,D); d(Y,X,D). d(pta, bfa, 455) dbfn, ct,990) d(bfn,pe,680) a(zhb, kby, 470). (ct, kby, 970) coastal(ct) coastal (pe) interior (X):- not(coastal (X)) collect1(L) - bagof(x,distance(X,Y,D),L) collect2(L):- setof (X,D\distance (X,Y,D),L) (a) Give the value of L returned by the following query 7- collecti(L). (b) Give the value of L returned by the following query ?- collect2(L). (c) Give all the results of the following query 2- coastal (X), once(distance (X,Y,D)), interior (Y) (d) Give all the results of the following query: 7- coastal(X), not((distance (X,Y,D), coastal(Y)))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
