Exercises part 2
-
Show that
InSchema
is decidable by changing the output type ofinSchema
toDec (c ** InSchema n ss c)
. -
Declare and implement a function for modifying a field in a row based on the column name given.
-
Define a predicate to be used as a witness that one list contains only elements in the second list in the same order and use this predicate to extract several columns from a row at once.
For instance,
[2,4,5]
contains elements from[1,2,3,4,5,6]
in the correct order, but[4,2,5]
does not. -
Improve the functionality from exercise 3 by defining a new predicate, witnessing that all strings in a list correspond to column names in a schema (in arbitrary order). Use this to extract several columns from a row at once in arbitrary order.
Hint: Make sure to include the resulting schema as an index, but search only based on the list of names and the input schema.