PPT Slide
assert{ }( C ) adds clause C to the database at the
retract( C ) removes the first clause that matches C from the database.
new_fact :- read( A1), read( A2 ), read( A3 ), functor( C, A3, 2 ), arg( 1, C, A1 ), arg( 2, C, A2 ), assert( C ) .
This rule reads 3 terms; uses functor to set up a structure named C with A3 as its predicate, and room for 2 arguments; uses arg to make A1 and A2 the arguments; and asserts it.