Search code examples
kdbq-lang

q - Application by name


In the q for mortals chapter on functions there is a little paragraph on "Application by name":

q)f:{x*x}
q)f[5]
_
q)`f[5]
25
q)`f 5
_
q).my.name.space.f:{2*x}
q)`.my.name.space.f[5]

I don't understand where and why this would be used.

Thanks for the help


Solution

  • If we needed to call a function on a remote q server, and all we had was its name, then we could write

    h (`.my.ns.function;x;y)
    

    and receive a result - all with a symbol reference.