Tests in alice.tuprolog.concordion.ClauseCreationandDestruction reveal metapredicates (assert, retract, abolish) should perform more tests and rise errors accordingly
For instance:
-
asserta((atom(_) :- true)).
should raise an error- because rules cannot be asserted
-
assertz((atom(_) :- true)).
should raise an error- because rules cannot be asserted
-
retract(insect(I)), write(I), retract(insect(bee)), fail.
should raise an error instead of simply failing- because the retract should have no effect, thus leaving the
I
variable unbound, thus provoking the write to throw the error
- because the retract should have no effect, thus leaving the
-
retract((4 :- X)).
should raise an error instead of simply failing- because the retracted argument is not a valid rule (no struct as head), or simply because it is not possible to retract rules
-
retract((atom(X) :- X == '[]')).
should raise an error instead of simply failing- because it is not possible to retract rules
-
abolish(foo).
should raise an error instead of simply failing- because it is not possible to abolish facts
Edited by Giovanni Ciatto