Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong type error when creating a table with symbols with spaces in kdb/q

Tags:

kdb+

I am trying to create a table of symbols in kdb, where the values of the table have spaces within. I have got

tab:([colOne:`$"value 1"`$"value 2"]colTwo:`$"value 3"`$"value 4")

currently, but this just returns

ERROR: `type (wrong type)

i have followed http://www.kdbfaq.com/kdb-faq/tag/sym-with-a-space

like image 543
ElFik Avatar asked Sep 14 '25 04:09

ElFik


1 Answers

Should be:

tab:([colOne:`$("value 1";"value 2")]colTwo:`$("value 3";"value 4"))

Remember that evaluation in q is left-to-right:

colTwo:`$"value 3"`$"value 4"
`$"value 4" will be evaluated to symbol

Then it will try to apply this symbol to what's on the left:

"value 3" `$"value 4"

which will give you 'type

like image 127
Sergey V Avatar answered Sep 16 '25 16:09

Sergey V