From d2cebdef6d49dbe29312892b5acf2ff48ed1e596 Mon Sep 17 00:00:00 2001 From: duboissim Date: Fri, 1 Mar 2024 14:07:09 +0100 Subject: [PATCH] added . to predicate declarations --- solution.pl | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/solution.pl b/solution.pl index 56ccca3..f9b3d6d 100644 --- a/solution.pl +++ b/solution.pl @@ -1,16 +1,17 @@ +:- dynamic tables/0. /* Prints the names of all existing tables, one per line (use writeln/1). A table name is always an atom. */ tables. -:- dynamic tables/1 +:- dynamic tables/1. /* Unify Tables with a list of the names of all existing tables. */ tables(Tables). -:- dynamic table/2 +:- dynamic table/2. /* When this predicate is executed, the effect will be the creation of a new table with the specified list of column names (order matters!). @@ -21,7 +22,7 @@ All exceptions must have a descriptive error message. */ create table(Table, Cols). -:- dynamic cols/2 +:- dynamic cols/2. /* Unifies Cols with the list of columns for the specified table (in the same order as they were supplied to create table/2). @@ -30,14 +31,14 @@ exception (use throw/1). */ cols(Table, Cols). -:- dynamic row/2 +:- dynamic row/2. /* Unifies Row, one result at a time, with each row in the given Table. If the given table does not exist, the predicate should fail. */ row(Table, Row). -:- dynamic rows/1 +:- dynamic rows/1. /* Displays all rows in the given table, one per line (use writeln/1). If the given table does not exist, the predicate must throw a descriptive @@ -45,7 +46,7 @@ exception. */ rows(Table). -:- dynamic insert/2 +:- dynamic insert/2. /* When this predicate is executed, the effect will be the addition of a given row in the given table. The given row is a list of values for each of the @@ -58,7 +59,7 @@ the table, the predicate must throw a descriptive exception. */ insert(Table, Row). -:- dynamic drop/1 +:- dynamic drop/1. /* When this predicate is executed, the effect will be the deletion of the given table. @@ -70,7 +71,7 @@ exception. */ drop(Table). -:- dynamic delete/1 +:- dynamic delete/1. /* When this predicate is executed, the effect will be the deletion of all rows in the given table. The table itself should still exist after, but with no @@ -80,7 +81,7 @@ exception. */ delete(Table). -:- dynamic delete/2 +:- dynamic delete/2. /* When this predicate is executed, the effect will be the deletion of all rows from the given table that match all of the given conditions. The table @@ -94,7 +95,7 @@ prompt, but which may include selectors. Selectors are terms of the form */ delete(Table, Conds). -:- dynamic selec/4 +:- dynamic selec/4. /* Note that the name of this predicate is selec (without t) for the simple reason that select/4 is already a built-in Prolog predicate. @@ -126,14 +127,14 @@ returns: Projections = [[0, "Jeffrey"], [1, "Lorena"], [2, "Joseph"], ... */ selec(Table, Selectors, Conds, Projection) -:- dynamic selec/3 +:- dynamic selec/3. /* Simplified variant of the selec/4 predicate when there are no conditions to be checked. */ selec(TableOrTables, Selectors, Projection) -:- dynamic query/2 +:- dynamic query/2. /* where Query is a string whose syntax is defined by the following grammar: ⟨query⟩ ::= ⟨select⟩ | ⟨insert ⟩ @@ -181,7 +182,7 @@ success, and if query/2 is used the Result parameter can be ignored. */ query(Query, Result) -:- dynamic query/1 +:- dynamic query/1. /* cf. query/2 */