cubAndGoose
cubAndGoose

Reputation: 21

What to do the weird function parameters of kdb work?

From the execution control chapter, it seems to me that the function parameter has strange implementation like in the code below:

zs:{`d`P`L`G`D!(system"d"),v[1 2 3],enlist last v:value x}

Upvotes: 1

Views: 409

Answers (1)

terrylynch
terrylynch

Reputation: 13572

They are not function parameters. Function parameters will either always be encased in square brackets like so:

{[a;b] .... }

or they will be implied to be x,y,z if not specified

{x+y}

What the debug function is doing is running "value" on the supplied function x, which yields useful info as described here in http://code.kx.com/q/ref/metadata/#value

Given a function, it returns the list
(bytecode;parameters;locals(context;globals);constants[0];...;constants[n];definition)

Then it is extracting the 2nd, 3rd, 4th and last output from that, prepending the current namespace/directory (system"d") and finally creating an output dictionary using d/P/L/G/D as the keys

Upvotes: 3

Related Questions