resultList(UsersQuery):- question(X,H), write(H), myintersection(H,UsersQuery,Match,TotalQuestionKeywords), Percent is Match/TotalQuestionKeywords*100,
Maybe do retractall/1 before you rerun your program.
retractall/1
Make a separate predicate for assertion that checks if fact is not yet asserted:
assertThisFact(Fact):- \+( Fact ),!, % \+ is a NOT operator. assert(Fact). assertThisFact(_).