cancel
Showing results for 
Search instead for 
Did you mean: 

A question about dictionary in Q

jerry_xue_dev
New Contributor
Hi,

I started learning kdb+/q recently. I got a problem while create a dictionary.

According to the online guide, a dictionary could be created like this:

q)dict:`items`sales`prices!(items;sales;prices)

However, when I tried this:

q)dict:`items!(items)

I got error message: `type.

Anyone know why it is so? Thanks!
2 REPLIES 2

charlie
New Contributor II
New Contributor II
a dictionary is a map from one list to another.
hence the args must be lists/vectors, not scalars/atoms.
use enlist to form a list from a scalar.


dataGuyJosh
New Contributor II

As charlie described, a dictionary with one element needs to be enlisted, a shorthand for this might look like

d:d!d:enlist`items