Vector/Set/Tuple with NULLs
Vectors with NULLs:
$ x=1 2 NULL NULL 3;
$ y=2 NULL NULL 3 4;
$ x+y;
[3,,,,7]
$ x*y;
[2,,,,12]
$ x**y;
14
// 内积
$ sum x;
6
$ x<y;
[1,0,0,1,1]
$ x||1;
[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;
set(00i)
// the common element between x and y is NULL.
$ NULL in x;
1
$ size(x);
1
// set x is not empty: it has one element "NULL"
$ c=set(2 3);
$ y=a&c;
$ y;
set()
$ size(y);
0
// this is the only function to check whether a set is empty
Tuples with NULLs:
$ x=(1, NULL);
$ x+1;
(2,)