English 中文(简体)
Concat string with number in kdb+ q
原标题:
  • 时间:2023-08-06 03:01:10
  •  标签:
  • kdb
  • q

I can append a string with number.

temp:30
text:"Current temperature is ",string temp
show text
type text

Result

"Current temperature is 30"
10h

However, if I append one more string, it becomes a list. (why?)

text:"Current temperature is ",string temp," degree celsius"
show text
type text

Result

C
u
r
r
e
n
t
 
t
e
m
p
e
r
a
t
u
r
e
 
i
s
..
0h

I can use sv with empty string as delimiter, is it the normal way to do it?

text:"" sv ("Current temperature is ";string temp;" degree celsius")
问题回答

comma operator treats each character in the concatenated string as a separate item and creates a list of those characters.

On the other hand, when you use sv with an empty string as the delimiter, it joins all the strings in the list into a single string, which is the desired behavior for concatenation.





相关问题
Concat string with number in kdb+ q

I can append a string with number. temp:30 text:"Current temperature is ",string temp show text type text Result "Current temperature is 30" 10h However, if I append one more ...

How do I save a program in kdb/q?

Most of the examples seem to be run in REPL mode. Is it possible to load myprog.q from disk?

Q (kdb): nested where query

What are the ways to in Q to use the results of a nested query in a where clause? I m looking for something similar to SQL statement. select from food where type_id in ( select type_id from ...

Passing db path to l or .Q.l using a variable

I m writing a q script that loads a db in a particular path and does some processing on it. The location of the db is currently hardcoded in the script, but I want to pass the db path as an argument ...

How to convert tic data to 5 minute OHLC?

I am learning KDB+ and have loaded the tic data into the table W as below. My question is, how to transfer the data into 5 (or n) minutes OHLCVA? "Stk_ID","Date","Time","Price","Chg","Vol","Amt","Ty" ...

KDB Find first date with data in each table of a process

I am trying to find first date where we have data available per process over IPC. I tried below but it isn t efficient. Is there a better way to find this? select min date from ({select date from x ...

热门标签