Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prolog rule query

Status
Not open for further replies.

biki14

Programmer
Joined
May 14, 2012
Messages
1
Location
GB
/* The structure of a market analysis unit takes the form:
analysis_unit(Principal, Analysts, Coordinator).
Analysts is an arbitrarily long list of staff_member structures,
but excludes the staff_member structures for Principal and
Coordinator.
staff_member structures take the form:
staff_member(Surname,Initial,cv(Open_cases,Title,Market_area)).
*/
analysis_unit(staff_member(fox,m,cv(10,dr,technology)),
[staff_member(lamb,d,cv(9,mr,pharmaceuticals)),
staff_member(bird,s,cv(5,ms,manufacturing))],
staff_member(swift,p,cv(5,mrs,pharmaceuticals))).

analysis_unit(staff_member(bing,m,cv(9,mrs,home_entertainment)),
[staff_member(bing,k,cv(6,mr,home_entertainment)),
staff_member(bing,l,cv(5,mr,home_entertainment)),
staff_member(bing,m,cv(4,ms,home_entertainment))],
staff_member(bing,a,cv(3,mr,home_entertainment))).

analysis_unit(staff_member(bessemer,p,cv(15,miss,transport)),
[staff_member(bunsen,e,cv(10,mr,public_sector)),
staff_member(liebig,b,cv(6,mr,shipping))],
staff_member(schott,e,cv(3,mrs,shipping))).

analysis_unit(staff_member(reeves,r,cv(8,dr,agriculture)),
[staff_member(shankley,f,cv(7,dr,automotive)),
staff_member(banks,b,cv(5,miss,healthcare)),
staff_member(stiles,m,cv(4,mr,publishing)),
staff_member(bonetti,j_p,cv(4,dr,diy))],
staff_member(moore,e,cv(7,ms,media))).

Im meant to find the surname of any principal in whose analysis unit all staff members have
the same surname and the same market area.

I keep bringing back 3 answers i.e the surname Bing which is the correct answer.

Any feedback/help would be much appreciated.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top