Skip to content

null

Is null

null x     null[x]

Returns 1b where x is null.

null applies to all datatypes, and to items of lists, dictionary values, and table columns. For enumerations, null always returns 0b; see Enumerations.

null is an atomic function.

q)null 0 0n 0w 1 0n
01001b

q)where all null ([] c1:`a`b`c; c2:0n 0n 0n; c3:10 0N 30)
,`c2

Enumerations

null treats every enumerated value as non-null:

q)a:``a
q)`=`a$`            / non-enumerated and enumerated null symbol show as equivalent
1b
q)null`             / null symbol behaves as expected
1b
q)null`a$`          / enumeration of null symbol does not
0b

Enumerations are not intended to contain nulls: the null value indicates out of range. (Think of enumerations as a way to represent foreign keys.) To test for an enumeration backed by a null symbol, use the equality test, but expect it to take longer and use more memory:

q)a:10000000?`8
q)v:`a$a
q)\ts null v                / time and memory vary by machine
2 16777360
q)\ts `=v
20 150995168

null is a multithreaded primitive.


Enumerate, not