How does one declare an empty nested dictionary? The reason I’masking is because I’d liked to enforce types rather than just blindinserting entries in a data structure resembling a tree or a DAG.This doesn’t seem to work: ()!()!()What I’d ideally like to get is something like: (int$())!(
symbol$())!`int$()Any help or suggestions about alternative approaches are muchappreciated.Victor
You can’t. Both side of a dict are either lists or vectors, and if
they’re (general) lists, no restrictions are placed on them (as
usual).
Thanks, Aaron. That makes sense. If one can’t declare a nested
dictionary, what is the proper way to initialize them? I don’t want
to fill the data structure with dummies, but I don’t know how to get
the following to work. My only thought is that this is essentially
the same as indexing at depth (https://code.kx.com/trac/wiki/
QforMortals2/lists#Indexing-at-Depth), but for dictionaries instead of
lists.
d:()!()
.[d;(
a;b);,;
c]
To: personal-kdbplus@googlegroups.com
X-Mailer: Apple Mail (2.1078)
just use a (keyed) table
Attila
On 14 Apr 2010, at 18:20, Victor Wong wrote:
> Thanks, Aaron. That makes sense. If one can’t declare a nested
> dictionary, what is the proper way to initialize them? I don’t want
> to fill the data structure with dummies, but I don’t know how to get
> the following to work. My only thought is that this is essentially
> the same as indexing at depth (https://code.kx.com/trac/wiki/
> QforMortals2/lists#Indexing-at-Depth), but for dictionaries instead of
> lists.
>
> d:()!()
> .[d;(
a;b);,;
c]
>
> On Apr 13, 12:44 pm, Aaron Davies <aaron.dav…> wrote:
>> You can’t. Both side of a dict are either lists or vectors, and if
>> they’re (general) lists, no restrictions are placed on them (as
>> usual).
>>
>>
>>
>>
>>
>> On Tuesday, April 13, 2010, Victor Wong <victor.w…> =
wrote:
>>> How does one declare an empty nested dictionary? The reason I’m
>>> asking is because I’d liked to enforce types rather than just blind
>>> inserting entries in a data structure resembling a tree or a DAG.
>>
>>> This doesn’t seem to work: ()!()!()
>>
>>> What I’d ideally like to get is something like: =
(int$())!(
symbol$())!
>>> `int$()
>>
>>> Any help or suggestions about alternative approaches are much
>>> appreciated.
>>
>>> Victor
>>
>>> –
>>> You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
>>> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
>>> To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
>>> For more options, visit this group =
athttp://groups.google.com/group/personal-kdbplus?hl=en.
>>
>> –
>> Aaron Davies
>> aaron.dav...@gmail.com
>
> –
> You received this message because you are subscribed to the Google =
Groups “Kdb+ Personal Developers” group.
> To post to this group, send email to =
personal-kdbplus@googlegroups.com.
> To unsubscribe from this group, send email to =
personal-kdbplus+unsubscribe@googlegroups.com.
> For more options, visit this group at =
http://groups.google.com/group/personal-kdbplus?hl=en.
>
</victor.w…></aaron.dav…>
Thanks, Attila. That’s a good idea.
Victor
Okay,
What time is Matt going to be there? I would be there early since its his last day of freedom!