Vector/Set/Tuple with NULLs
Vectors with NULLs:
x=1 2 NULL NULL 3;
y=2 NULL NULL 3 4;
x+y;
// output
[3,,,,7]
x*y;
// output
[2,,,,12]
x**y;
// output
14
// inner product
sum x;
// output
6
x<y;
// output
[1,0,0,1,1]
x||1;
// output
[1,1,,,1]
// a binary operation on NULL returns NULL except relational operators such as <, <=, etc
Sets with NULLs:
a=set(1 NULL)
b=set(2 NULL);
x=a&b;
x;
// output
set(00i)
// the common element between x and y is NULL.
NULL in x;
// output
1
size(x);
// output
1
// set x is not empty: it has one element "NULL"
c=set(2 3);
y=a&c;
y;
// output
set()
size(y);
// output
0
// this is the only function to check whether a set is empty
Tuples with NULLs:
x=(1, NULL);
x+1;
// output
(2,)