dotq - kdb+: use string as variable name -
how can use string variable name?
i want variable name constructed during runtime, how can use left argument , assign value it?
example:
[`$"test"] : 1 / 'assign error
you use "set" create global:
q){(`$"test") set 1;test}[] 1 q)test 1
or (as noted user2393012 in comments):
@[`.;`test;:;1]
if want avoid globals use sort of namespace/dictionary/mapping:
q){d:()!();d[`$"test"]:1;d`test}[] 1
Comments
Post a Comment