drop/1, delete/1

This commit is contained in:
Brieuc Dubois 2024-03-10 14:19:45 +01:00
parent 4ec8cba12b
commit fed10a2a25
1 changed files with 10 additions and 2 deletions

View File

@ -81,7 +81,11 @@ and signature later on.
If the given table does not exist, the predicate must throw a descriptive If the given table does not exist, the predicate must throw a descriptive
exception. exception.
*/ */
/* drop(Table). */ drop(Table) :-
(tabl(Table, _) ->
delete(Table), retract(tabl(Table, _));
throw("Table doesn't exist")
).
:- dynamic delete/1. :- dynamic delete/1.
/* /*
@ -91,7 +95,11 @@ more rows.
If the given table does not exist, the predicate must throw a descriptive If the given table does not exist, the predicate must throw a descriptive
exception. 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. :- dynamic delete/2.
/* /*