raze(listOfHandles)@\:({[x;y] funcUsingXandY};arg0;arg1)
where:
listOfHandles - a list of handles to remote processes
@\: - apply the right hand side to each item in the left hand side list
({[x;y] funcUsingXandY};arg0;arg1) - this sends a function definition (lambda) + args for the function, to be executed on each of the handles.
1 回答
看看你提供的代码,看起来可能有些东西丢失了 - 我会告诉你代码所做的预期形式:
示例(假设有进程侦听localhost,端口7070和7071):
在上面的例子中,我们在每个远程句柄
handle1
和handle2
上执行带有args(39;3)
的函数{[x;y] enlist(.z.p; x+y)}
- 我们得到当前时间的响应(.z.p
)和每个句柄的响应中两个args的总和 .raze
将从每个句柄返回的结果连接到一个列表中(在您的示例中,看起来该函数返回一个表 - 在这种情况下,raze
将连接从句柄返回的表列表到单个表中)Edit: 我错过了关于
.
的问题的部分 - . 允许您将参数列表应用于采用多个参数的函数 - 例如:有关详细信息,请参阅:
http://code.kx.com/wiki/JB:QforMortals2/i_o#Message_Format
http://code.kx.com/wiki/JB:QforMortals2/functions#Adverbs
http://code.kx.com/wiki/JB:QforMortals2/functions#Functional_Forms_of_Amend
http://code.kx.com/wiki/Reference/DotSymbol