trace
domains
sublist = symbol*
database
teachers(symbol,sublist)
lectures(symbol,integer)
predicates
find_no_lect(symbol)
initialize()
find_sub(sublist,integer,integer)
display1(symbol,integer)
go
goal
go.
clauses
go :-
initialize(),
find_no_lect("bt").
initialize() :-
assert(teachers("bt",[cpp,nt1,nt2])),
assert(teachers("ba",[cobol,dfs,consm])),
assert(teachers("harshal",[c,conm,ss])),
assert(lectures("cpp",10)),
assert(lectures("nt1",10)),
assert(lectures("nt2",5)),
assert(lectures("cobol",15)),
assert(lectures("dfs",10)),
assert(lectures("consm",9)),
assert(lectures("c",2)),
assert(lectures("conm",20)),
assert(lectures("ss",15)).
find_no_lect(N) :-
teachers(N,S_LIST),
find_sub(S_LIST,0,0).
find_sub([H|T],CNT,NO2) :-
TMPLIST = [H|T],
CNT1 = CNT + 1,
lectures(H,NO1),
NO = NO2 + NO1,
display1(H,NO),
find_sub(T,CNT1,NO).
display1(S,N) :-
write(S), write(" "), write(N),nl.