If z appears in the definition of an argument-less function, then the function takes 3 arguments. It is not necessary for x or y to appear:

q)f: {z}
q)f[3]
{z}[3]
q)f[3; 4; 5]
5
q)

Similarly, if y appears but z does not appear, then the function takes 2 arguments. What may surprise you is that, if none of x, y, or z appear, then the function takes a single argument called x:

q)f: {42}
q)f[]
42
q)value f
0xa00001,`x
`symbol$()
,`
42
“{42}”
q)

This is only of practical import if you want to test a function for how many arguments it takes. If you really want to define a function taking no arguments, you might try to use an empty parameter list:

While we’ve succeeded only in defining a function with a single, unnamed parameter, all is not lost. If you follow a convention of always declaring nullary functions in this way, that’s enough to test at runtime how many arguments a function requires.

This work is licensed under a Creative Commons License.
The views and opinions expressed herein are those of the authors and do not necessarily reflect those of any other person or legal entity.
Kdb+ is the registered trademark of Kx Systems, Inc.