listing(X)
allows you to inspect the clauses you currently have loaded. Causes all clauses with X
as the predicate name to be written to the current output stream.
Examples
test(X) :- X < 3.
test(X) :- X > 9.
test(X) :- X = 5.
?- listing(test).
test(X) :- X < 3
test(X) :- X > 9
test(X) :- X = 5
yes
overloaded_predicate_name(X) :- X = this_rule_has_one_argument.
overloaded_predicate_name(X, Y) :- X = this_rule_has_two_arguments, X = Y.
?- listing(overloaded_predicate_name).
overloaded_predicate_name(X) :- X = this_rule_has_one_argument
overloaded_predicate_name(X, Y) :- X = this_rule_has_two_arguments , X = Y
yes
?- listing(predicate_name_that_doesnt_exist_in_knowledge_base).
yes
?- listing(X).
Expected an atom but got: VARIABLE with value: X