From 2cf01ac3aeabe5653c71821001faab01a20cd9f2 Mon Sep 17 00:00:00 2001 From: Brieuc Dubois Date: Sun, 10 Mar 2024 14:40:10 +0100 Subject: [PATCH] delete/2 --- solution.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/solution.pl b/solution.pl index f73b64f..3a5062f 100644 --- a/solution.pl +++ b/solution.pl @@ -113,7 +113,11 @@ prompt, but which may include selectors. Selectors are terms of the form +where should be replaced by a column name. (See tests.pl for some concrete usage examples.) */ -/* delete(Table, Conds). */ +delete(Table, Conds) :- + (tabl(Table, _) -> + (rows(tables, Row), \+ (member(Cond, Conds), \+ Cond) -> retract(Row); true); + throw("Table doesn't exist") + ). :- dynamic selec/4. /*