2014.08.09 02:08 AM
q)dict:`items`sales`prices!(items;sales;prices)
q)dict:`items!(items)
2014.08.11 01:42 AM
2021.06.16 05:55 PM
As charlie described, a dictionary with one element needs to be enlisted, a shorthand for this might look like
d:d!d:enlist`items
2022.01.06 03:53 AM
That does construct a singleton dictionary but the keys and values are the same, which might not be what the OP wanted.
q)show d:d!d:enlist`items
items| items
Happily the 1 f\
‘Zen monks’ pattern can be used to convert a variable name into a dictionary of its name and its value.
q)items:`cow`sheep`cat`dog
q).[!] enlist each 1 value\`items
items| cow sheep cat dog
I’ll write more about the Zen monks soon.
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.