kdb+ and q
Q+A on all things kdb+ database and the q language
Showing results for 
Search instead for 
Did you mean: 

Forum Posts

Protected Evaluation problem.

Content-Disposition: inline Sample:q) id: 5q) @[show; id; `error] / ok.5q) @[show; id; id:0] / strange!0q) id0Why?Citation from QforMortals books ( https://code.kx.com/trac/wiki/QforMortals/execution_control#Protected-Evaluation @[fmon;a;exprfail] .[...

How to compile parse tree into bytecode?

Letq) f1 : {r:(); do[1000000;r,:($[(m:(1?10)[0]) > 5;m;0])];r} / somefunctionq) p1 : parse "r:(); do[1000000;r,:($[(m:(1?10)[0]) > 5;m;0])];r" /conform to body f1 parse treeq) p1 (";";(:;`r;());(`do;1000000;(,:;`r;($;(>;(:;`m;((?;1;10);0));5);`m;0)))...

Re: [personal kdb+] Re: Variable scoping

A nested function can refer to globals and its own variables & args but not of any surrounding function's locals & args. Consider: q)f:{[x]{[y]x+y}} q)g:f 1 q)g {[y]x+y} g)g 2 'a // fails because global a is undefined q)a:3 q)g 2 5 q does not give yo...

KDB/Q position - NYC

Received: by with SMTP id z17mr80611anh.15.1221071355375; Wed, 10 Sep 2008 11:29:15 -0700 (PDT)Date: Wed, 10 Sep 2008 11:29:15 -0700 (PDT)X-IP: G2/1.0X-Google-Token: sKvF7wwAAABVmHw8Ig09ANzfNmXCWUPjX-HTTP-UserAge...

Variable scoping

Content-Disposition: inline Why this sample not work?f1 : {[x] {[y] x+y}}(f1[5])[7] / fail!