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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

student knowledge base

Status
Not open for further replies.

goldking123

Instructor
Dec 19, 2015
1
0
0
PK
i have made knowledge base in prolog for a student. whose roll no, is 01, i have entered the courses taken by him, year,session,and grade. now i want to create a list of all the courses taken along waith the year and grade. i made following algo. but it didnt work. please help.
coursetaken(01,mt410,15,fall,'c').
coursetaken(01,mt411,15,fall,'b').
coursetaken(01,mt412,15,fall,'a').
coursetaken(01,mt413,15,fall,'c').
coursetaken(01,mt414,15,fall,'a').
coursetaken(01,mt415,15,fall,'a').
coursetaken(01,mt416,15,fall,'a').
coursetaken(01,mt417,15,fall,'a').
coursetaken(01,mt418,15,fall,'a').
coursetaken(01,mt419,15,fall,'a').
coursetaken(01,mt420,15,fall,'a').
coursetaken(01,mt421,15,fall,'a').
coursetaken(01,mt422,15,fall,'a').
coursetaken(01,mt423,15,fall,'a').
coursetaken(01,mt424,15,fall,'a').
coursetaken(01,mt425,15,fall,'a').
list_courses(Sid,L):-list_courses(Sid,[],L).

list_courses(Sid,Acc,L):-coursetaken(Sid,Cno,_,_,_),\+member(Cno,Acc),
append([Cno],Acc,L1), list_courses(Sid,L1,L),!.
list_courses(_,Acc,Acc).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top