PPT Slide
Clause provides another way of selecting Horn clauses.
Clause( X, Y ) succeeds if it can match X and Y to the head and body of an existing clause in the database.
X must be instantiated enough so that the main predicate is known. Only works for dynamically asserted clauses!!
list1( X ) :- clause( X, Y ), output_clause( X, Y ), write( ' · ' ), nl, fail.
output_clause( X, true ) :- !, write( X ).
output_clause( X, Y ) :- write( ( X :- Y ) ).
Note that for facts, the tail is true.
Ex. assert( q ( a, b ) ).