diff --git a/solution.pl b/solution.pl index b6c243c..f73b64f 100644 --- a/solution.pl +++ b/solution.pl @@ -81,7 +81,11 @@ and signature later on. If the given table does not exist, the predicate must throw a descriptive exception. */ -/* drop(Table). */ +drop(Table) :- + (tabl(Table, _) -> + delete(Table), retract(tabl(Table, _)); + throw("Table doesn't exist") + ). :- dynamic delete/1. /* @@ -91,7 +95,11 @@ more rows. If the given table does not exist, the predicate must throw a descriptive exception. */ -/* delete(Table). */ +delete(Table) :- + (tabl(Table, _) -> + tabl(Table, C), length(C, L), call(abolish, Table, L); + throw("Table doesn't exist") + ). :- dynamic delete/2. /*