q lang - (kdb+/q) append to dictionary -


i trying programmatically construct arguments functional select call having form:

?[ `t; () ; groupby; ()] 

the problematic part groupby, should dictionary.

suppose objective arrive @ parse tree in form:

parse "select sym,month:`date$dt.month t" 

i start constructing by part with:

groupby: enlist[`sym]!enlist(`sym) 

then try append month part of group statement (note periodicity parameterised):

per: `month / monthly periodicity groupby,: {enlist[x]!enlist[ $[x = `day;                                 `dt;                                 $[x=`month;                                  ((parse "select month:`date$dt.month x")@3)@`month                                  ;` sv (`dt,x)]                                ]]           }[per] 

however, throws type error. goes wrong?

i think doesn't compound assignment

groupby,:{...}  

try

groupby:groupby,{...} 

the difference in first case it's trying directly alter data in memory without creating copy, whereas in second case creating copy of data in memory , re-assigning variable. perhaps compound assignment works when types uniform


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -