Skip to content
Snippets Groups Projects
Commit 87fd77bb authored by pm3g19's avatar pm3g19
Browse files

Created solutions for all five problems

parent d4b0e894
No related branches found
No related tags found
No related merge requests found
.in
A:2, # declare input files and their numbers of cols in .in section
B:2
.out # statements for the query are in .out section
A x B; # returns the cartesian product of the two sets (conjunction)
\ No newline at end of file
.in
A:3
.out
filter((r) -> isSubstring(r[1], r[2]));
\ No newline at end of file
.in
A:3
.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.
.in
P: 4,
Q: 4
.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
.in
A:1
.out
map[A](\r -> [r[1],"0",r[1]]);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment