On Sunday, November 4, 2018 at 6:49:20 PM UTC+2, Nick wrote:
if you want to ensure this always works, start your dictionary with a null value:
q)cc:``ab
c!(::;10;11;12)
q)type value cc
0h
q)cc.a
10
note that this is how directories work:
q)0N!1#.q
(,)!,:: | :: q)0N!1#.o (,
)!,::
| ::
q)0N!1#.h
(,`)!,::
| ::
Yes, funny:
q).new1.d:1
q).new1.c:2
q)show .new1.d
1
q)type value .new1
0h
q).new1 _:`
q)type value .new1
7h
q)show .new1.d
'type
[0] show .new1.d
^
Interesting that dictionaries internally seem to keep track of their mixed-ness.
Look:
q)d:(raze (s
n1n2;(1000000?
8)))!raze (`a;22;33;(1000000)?1000000)
q)\t:10 type value d
0
q)\t:10 d2:delete n2 from d
145
q)\t:10 d1:delete n1 from d
182
q)\t:10 ds:delete s from d
257
q)\t:10 type value ds
0
Note deleting single outlier (`s) took longer (reproducible). Probably typed dictionaries have different storage layout.
it is not hidden, you just have to look in the right place.
Q For Mortals 3 - dictionaries chapter - not right place.
/Tutorials/Dictionaries - not right place
/Reference/DotSymbol - not right place.
please share your sources here ;)
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 13.0px Arial; color: #232323; -webkit-text-stroke: #232323; min-height: 15.0px}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 13.0px Arial; color: #232323; -webkit-text-stroke: #232323}span.s1 {font-kerning: none}