This commit is contained in:
Brieuc Dubois 2024-03-10 13:14:13 +01:00
parent 56e393f049
commit 4ec8cba12b
1 changed files with 9 additions and 1 deletions

View File

@ -61,7 +61,15 @@ exception.
If the row does not have as many elements as the number of columns in
the table, the predicate must throw a descriptive exception.
*/
/* insert(Table, Row). */
insert(Table, Row) :-
(tabl(Table, Cols) ->
(length(Row, L1), length(Cols, L2), L1 =:= L2 ->
Term =.. [Table | Row],
assertz(Term);
throw("Row doesn't have as many elements as the number of columns in the table")
);
throw("Table doesn't exist")
).
:- dynamic drop/1.
/*