Kdb 将多个参数传递给select中的函数

Kdb 将多个参数传递给select中的函数,kdb,Kdb,我想用select计算一个新列,它是多个列的函数 我的实际应用程序将涉及select中的分组,因此我将传递给函数的列条目将包含列表。但这个简单的例子说明了我的问题 t:([] a:1 2 3; b:10 20 30; c:5 6 7) / Pass one argument, using projection (set first two arguments to 1) select s:{[x;y;z] x+y+z}[1;1;] each a from t / Pass two argu

我想用select计算一个新列,它是多个列的函数

我的实际应用程序将涉及select中的分组,因此我将传递给函数的列条目将包含列表。但这个简单的例子说明了我的问题

t:([] a:1 2 3; b:10 20 30; c:5 6 7)

/ Pass one argument, using projection (set first two arguments to 1)
select s:{[x;y;z] x+y+z}[1;1;] each a from t 

/ Pass two arguments using each-both (set first arg to 1)
select s:a {[x;y;z] x+y+z}[1;;]'b from t 

现在,我如何传递三个或更多参数?

下面的表单通常适用

q)t:([]a:til 10;b:til 10;c:til 10)
q)select d:{x+y+z}'[a;b;c] from t
d
--
0
3
6
9
..

一般来说,每种方法都有效,但最好尽可能使用向量运算。在这里,我使用的是。运算符将函数\t应用于两种方法的时间。我将其结果存储到r1/r2,以显示它们是相同的:

q)t:([]a:til n;b:til n;c:til n:1200300)
q)\t r1:update d:{x+y+z}'[a;b;c] from t
289
q)\t r2:update d:{x+y+z} . (a;b;c) from t
20
q)r1~r2
1b
q)r2
a  b  c  d
-----------
0  0  0  0
1  1  1  3
2  2  2  6
3  3  3  9
4  4  4  12
5  5  5  15
..
干杯, 瑞安