在KDB中不工作的每个内部使用翻转

在KDB中不工作的每个内部使用翻转,kdb,Kdb,使用表上的each,我希望each以单行表的形式一次操作一行。但是,首先要将其转换为字典: q) t:flip `a`b!(enlist 1;enlist 2); q) {type x} each t enlist 99h / dictionary 因此,显而易见的做法是使用flip将字典制作成表格: q) {type flip x} each t An error occurred during execution of the query. The server sent the res

使用表上的
each
,我希望
each
以单行表的形式一次操作一行。但是,首先要将其转换为字典:

q) t:flip `a`b!(enlist 1;enlist 2);
q) {type x} each t
enlist 99h  / dictionary
因此,显而易见的做法是使用
flip
将字典制作成表格:

q) {type flip x} each t
An error occurred during execution of the query.
The server sent the response:
rank
Studio Hint: Possibly this error refers to invalid rank or valence

嗯,那太好了。不能翻动字典吗??出什么问题了?

记住,表格是一个字典列表

q)show each ([]a:1 2 3;b:4 5 6);
a| 1
b| 4
a| 2
b| 5
a| 3
b| 6

每个字典的值都是原子,而不是列表。因此,您不能通过这种方式将词典翻转到表中,您必须确保值是列表

q)enlist each ([]a:1 2 3;b:4 5 6)
+`a`b!(,1;,4)
+`a`b!(,2;,5)
+`a`b!(,3;,6)
q)type each enlist each ([]a:1 2 3;b:4 5 6)
98 98 98h
可以重写为
(键入enlist@)每个([]a:123;b:456)
(或者甚至是
('[type;enlist]),每个([]a:123;b:456)
,如果你想喜欢的话)