问题标签 [k]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
kdb - q 和 kh 中的 NULL
我发现和h之间的 NULL值不同:k.hq
这q一切看起来很熟悉,但k.h nh似乎很奇怪:
为什么它的(I)0xFFFF8000价值nh?- 为什么他们不只是简单地说(H)0x8000?
kdb - 从外部选择内部选择一个表
我已经看到了一种使用 an 的技术update(我猜主要是为了添加新列的副作用)update someFun each t from t:. 使用这种技术是好还是坏?
一些实验:
似乎我们可以使用不同的表来做到这一点,所以我猜我们会有 2 倍的内存过度使用。
但:
对于所有内存情况,给出几乎相同的结果。我想知道为什么内存消耗是一样的?
kdb - q 中的多变量赋值
这段代码看起来像多变量赋值:
为什么它会这样工作?为什么它与(a;b):10 20(不起作用)不同?
我想第二行只会进行临时分配 - 实际上不会替换值。但它会的。
kdb - 为键控表中的所有列选择不同的
似乎我们无法以与未键控相同的方式从键控表中获取不同的值:
为什么我们这里有这个错误?
kdb - 无法评估手动创建的相等〜解析树
怎么可能是手动创建的解析树与parse运算结果相等:
并且无法通过eval?评估相同的表达式
我想我错过了什么,但是什么?
更新:这种方法正确吗?
kdb - 如何构建投影的解析树?
我想以某种方式将解析树保存到文本格式文件中,而不是将其带回q.
但是解析树可能包含投影,比如说+[;1]2。我应该如何处理这些文件树并正确保存/加载它?::在以下示例中尝试直接使用时出现错误:
我认为解决此问题的一种方法是::用空字符串替换所有内容,然后应用eval/
但也有其他::必要的情况,例如:
那么,对于这两种情况,我如何才能正确地以文本格式保存(/加载)解析树呢?
我想要一些奇怪的东西吗?是否有可能在 中获得一对一的抽象语法树程序表示q?
kdb - 重塑 [cols;table]
如何从表中获取列?如果它们不存在,可以将它们作为空列。
尝试reshape#:
为什么reshape#操作员不在桌子上工作?它可以轻松地作用于每一行(即 dict)并组合结果。所以我不得不写:
这是最短的方法吗?
kdb - 奇怪的视图声明行为
在 q 3.6 32bit 中,我看到了一些我无法解释的东西。拥有相同的解析树,这两个表达式 fory1和 fory2给出了太不同的结果:
为什么这里的空间如此有意义?
kdb - .Q.trp 和 bt 处理
我看到(在.Q.fpn)以下技术来解析和显示bt传递给.Q.trp函数的对象:
'(x;y)看起来像是一个异常构建结构,但 Kx 文档说只有两种异常构建方式:从符号和字符串。看起来我们可以从(symbol; bt object).
那么建筑'(x;y)代表什么?
我们可以构建与异常不同的东西'(x;y)吗?
kdb - Enums for tables
I found no information about what the enum is over the table domain on https://code.kx.com/q/ref/enumerate/. But something interesting exists there: https://code.kx.com/q/kb/linking-columns. I tried those examples and found an enum structure that behaves in some situations like a normal enum, but has a strange behaviour in others.
From this perspective et1 and et2 both have similar behaviour. But if we check other enum properties, we see differences:
The situation seems more weird if we build enums for just a keyed tables: see a difference for a table with one key column and for two:
The same hardcoded (with !) enum notation for kkt.
So the question: what are they? - those enums with a familiar $ and with a hardcoded ! notaions for a table? Is it possible to apply enum-extend technique (?) for them and how? And is there any documentation for them?