下面是DolphinDB database 流数据教程中摘录的代码:
share streamTable(10000:0,`timestamp`temperature, [TIMESTAMP,DOUBLE]) as pubTable
vtimestamp = 1..100
vtemp = norm(2,0.4,100)
tableInsert(pubTable,vtimestamp,vtemp)
其中tableInsert有三个参数:pubTable,vtimestamp,vtemp。但在help文档中,其语法为:
tableInsert(X, Y)
其中参数Y可以是一个表或一个元组。上述例子中调用方法符合这个语法吗?这是对元组作为函数参数时的写法?
这种参数是元组用法, tableInsert(t, ([31,32,33], [41,42,43])), 其实跟多个vector tableInsert(t, [31,32,33], [41,42,43])的原理上是一致的。在DolphinDB中,多个vector其实也是一个元组,比如x = ([1, 2, 3], [4, 5, 6]),x的类型就是元组。