%trace
domains
no_list = integer*
database
numbers(integer)
temp(integer)
predicates
% nos(no_list)
find_maximum()
% insert_into_db(integer,no_list)
% display_db()
go
initialize
goal
go.
clauses
/* go :-% nos([5,6,3,8,9]), insert_into_db(5,[5,6,7,8,9]). insert_into_db(CNT,[H|T]) :- assert(numbers(H)), CNT1 = CNT - 1, CNT1 > 0, insert_into_db(CNT1,T). insert_into_db(0,[H|T]) :- display_db(). display_db() :- numbers(N), write(N), nl, fail.*/
go :-
initialize,
find_maximum().
initialize :-
assert(numbers(5)),
assert(numbers(8)),
assert(numbers(9)),
assert(numbers(2)),
assert(numbers(4)),
assert(temp(0)).
find_maximum() :-
numbers(NO),
temp(NO1),
NO > NO1,
retract(temp(NO1)),
assert(temp(NO)),
write(NO1), nl,
fail.