From 88cba6ba56cda4debb649ed60de58dc4b4201d28 Mon Sep 17 00:00:00 2001 From: p9malino26 <pm3g19@soton.ac.uk> Date: Tue, 27 Apr 2021 09:49:44 +0100 Subject: [PATCH] Corrected problem definitions --- solutions/pr3.cql | 9 ++++++--- solutions/pr4.cql | 8 ++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/solutions/pr3.cql b/solutions/pr3.cql index 89efa96..7bfc9d1 100644 --- a/solutions/pr3.cql +++ b/solutions/pr3.cql @@ -1,6 +1,9 @@ .in -A:3 +P: 4, +Q: 4 .out -filter (\r -> r[2] == r[3]); # data the the function works on (e.g. input set this time) goes in [], extra info (e.g. predicate in this case) goes in () -map(\r -> r[3,1]); # can also be map[\_](\r ...), where \_ is output of last operation. +P x Q; +filter(\r -> r[4] == r[5]); +let func f(x,y) = if (empty(x)) then y else x; +map(\r -> [r[1], f(r[2], r[6]), f(r[3], r[7]), f(r[4], r[8])); \ No newline at end of file diff --git a/solutions/pr4.cql b/solutions/pr4.cql index 7bfc9d1..b69b879 100644 --- a/solutions/pr4.cql +++ b/solutions/pr4.cql @@ -1,9 +1,5 @@ .in -P: 4, -Q: 4 +A:2 .out -P x Q; -filter(\r -> r[4] == r[5]); -let func f(x,y) = if (empty(x)) then y else x; -map(\r -> [r[1], f(r[2], r[6]), f(r[3], r[7]), f(r[4], r[8])); \ No newline at end of file +filter (\(r) -> notEmpty(r[2])) \ No newline at end of file -- GitLab