pass a "select" statement to a user defined function

Hi,

I’m new to q/kdb. I’m going to pass a “select” statement to a user defined function and would like it to run row-based.

For example, I have a table:

t:(a:(1 2; 3 4);b:(5 6; 7 8))

and a function:

lm:{[w;y]

x:(w; 1 1f);

x:flip x;

beta:inv[(flip x) mmu x] mmu (flip x) mmu y

}

It seems doesn’t work to use:

lm[select a from t;select b from t]

x:(w; 1 1f); get the result of:

(+`a!(1 2;3 4));1 1)

Can anybody helps? Many thanks!

Best,

Kelly

lm’[t1;t2]

This passes each row (as a dict) of t1 and t2 into lm.

That really helps!
Thank you!